I am trying to change Top links structure. I don't want to mess with xml files in default theme. I have only one xml file with everything inside. I don't want to create multiple xml files in my theme layout folder. I am trying to unset action inside top.links block.
This is the way I am trying to do:
<reference name="top.links">
<action method="unsetChild"><child>addLink</child></action>
<!-- <remove name="checkout_cart_link" /> -->
</reference>
When I put remove tag it works perfectly. But when I try to do unsetChild for addLink action it doesn't work. Do you know maybe how I should figure this out. I don't want separate xml files with the same names as in default theme.
The unsetChild
function is from the Abstract block model and is used for removing a block that is a child of the current block. The block with the name top.links
doesn't have a child block that is called addLink, hence the fact your configuration doesn't do anything. The action nodes with the method addLink
call the addLink function on the Mage_Page_Block_Template_Links
block. If the objective is to remove one of the links, you will need to use the action removeLinkByUrl
.
<reference name="top.links">
<action method="removeLinkByUrl"><url>link/here</url></action>
</reference>
The exact arguments will obviously depend on what link you are attempting to remove.