aParams does not show class in anchor
Question
I want to add a top link and I do this by the following in local.xml:
<reference name="top.links">
<action method="addLink" translate="label title">
<label>International</label>
<url>javascript:void(0);</url>
<title>international</title>
<prepare/>
<urlParams/>
<aParams>class="international"</aParams>
</action>
</reference>
unfortunately although I see the link in the top, it does not add the class to it here is the output I get:
<li class=" last"><a href="javascript:void(0);" title="international">International</a></li>
I was wonndering why it does not show
<li class=" last"><a class="international" href="javascript:void(0);" title="international">International</a></li>
Solution
the tag name you use for the parameters of methods called from the layout file are irrelevant. They are passed to the method in the way they are found.
So in your example <aParams>class="international"</aParams>
translates to position = 0
.
See here the parameters supported by the addLink
method
Your xml should look like this in order to work as you expect it:
<reference name="top.links">
<action method="addLink" translate="label title">
<label>International</label>
<url>javascript:void(0);</url>
<title>international</title>
<prepare/>
<urlParams/>
<position>0</position>
<liParams />
<aParams>class="international"</aParams>
</action>
</reference>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange