- Issue created by @freelock
- Merge request !361Issue #3516308 by freelock: Cannot subclass MenuSource plugin due to private method getMenuItem() β (Open) created by freelock
- π«π·France just_like_good_vibes PARIS
Hello,
thank you for this issue.
the method you want to expose as protected was not really designed to be opened to subclassas and be treated like an internal API.
why not using directly getPropValue to get the tree of items ? - πΊπΈUnited States freelock Seattle
Hi,
Ok, I see that method returns the result of getMenuItems(). We can definitely extend that instead, if that's the only place it gets called.
Cheers,
John - πΊπΈUnited States freelock Seattle
Oh sorry, looking again, we're not subclassing that method -- we're just calling it. As a private function we cannot use it -- it needs to be protected so we can call it from our subclass's getPropValue() function.
You can see our usage here: https://git.drupalcode.org/project/megamenu_sdc/-/blame/1.0.x/src/Plugin...
... we could create another copy of this code, but much easier to call existing...
- π«π·France just_like_good_vibes PARIS
Hello. i donβt understand your point ?
you can override getPropValue in your subclass to return what your source is supposed to return, at the same time you can also use getPropValue from the parent class, which is not private. - πΊπΈUnited States freelock Seattle
Hi,
You're right, I get the same thing from the parent getPropValue method.
Cheers,
John - π«π·France just_like_good_vibes PARIS
you are welcome, we are so happy people enjoy ui patterns 2 :)