Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is not possible to extend class methods #405

Open
marko-stimac opened this issue Dec 3, 2018 · 1 comment
Open

It is not possible to extend class methods #405

marko-stimac opened this issue Dec 3, 2018 · 1 comment
Assignees
Labels
[TYPE] BUG An issue reporting a bug [TYPE] ENHANCEMENT
Projects
Milestone

Comments

@marko-stimac
Copy link

Extending class is not possible anymore, I get errors when trying to redefine some things in start_el:

  Fatal error: Uncaught Error: Call to private method WP_Bootstrap_Navwalker::get_linkmod_type() 
  Error: Call to private method WP_Bootstrap_Navwalker::get_linkmod_type() 

In previous versions I has something like this, small code where I only changed a bits of code I needed in a single method. Currently only way to redefine it is to copy whole class?

class My_Bootstrap_Navwalker extends WP_Bootstrap_Navwalker {

    public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
         ...
    }

}
@pattonwebz pattonwebz added this to the 5.0.0 milestone Dec 4, 2018
@pattonwebz
Copy link
Member

Hmmm yes I see the issue here. The method is intended to only ever be referenced from inside the class so thus it was made private - perhaps protected was the better choice here? Maybe even just going to public?

A change like this would be considered a breaking change and require a major version bump to be pushed out. I do plan to work on the next major version in the coming weeks so I'm tagging this issue for that and will cycle back to this with a viable solution soon I hope.

Thanks for highlighting this.

@pattonwebz pattonwebz self-assigned this Dec 4, 2018
@pattonwebz pattonwebz added [TYPE] BUG An issue reporting a bug [TYPE] ENHANCEMENT labels Dec 4, 2018
@pattonwebz pattonwebz added this to To do in Walker v5 Jan 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[TYPE] BUG An issue reporting a bug [TYPE] ENHANCEMENT
Projects
Walker v5
  
To do
Development

No branches or pull requests

2 participants