netz98 / N98_LayoutHelper

Helpful methods to be called in layout actions to allow more customizations via local.xml without touching the original layout files. Remove links from the account navigation from local.xml layout updates without touching the original layout files. Add CSS/JS before or after existing elements
Open Software License 3.0
33 stars 8 forks source link

Remove function for additional blocks #2

Open amenk opened 11 years ago

amenk commented 11 years ago

Thanks for sharing your excellent work!! The LayoutHelper in particular is a great tool for someone almost just starting out with Magento but loving the xml layout system. But there are of course a few tough knots left that would have been gone if only the removeLink command was applicable everywhere :)

I had a quick look at doing the same for top & footer.links but realised it was beyond my knowledge so here's me asking if perhaps you had already tested that and if you have any result from it?

In the account nav there's the obvious constant $name but I fail to find the equivalent in the other links.

Wish you a good day :)

Peter Svegrup [via e-mail]

amenk commented 11 years ago

Hi Peter,

in Mage_Page_Block_Template_Links (which is responsible for the top.links) there are already some remove functions.

It might be possible to add an removeLinkByName or ByTitle which could look very similar to the removeLinkByUrl mehtod. Here you have to take care that the title and name tags can be translated - so when calling this method in the layout.xml the translate="..." attribute has to be added so that the link is matched in the correct language.

But maybe removeLinkByUrl is already sufficient for your use case?

Alexander