I have a working link being added to the top.links block like this:
<block type="page/template_links" name="top.links" as="topLinks">
<action method="addLink">
<label>About Us</label>
<url helper="mymodule/getAboutUsUrl"/>
<title>About Us</title>
<prepare/>
<urlParams/>
<position>20</position>
</action>
</block>
Eventually I wanted getAboutUsUrl to turn into getExternalSiteUrl. I want that one function to take parameters. For instance, getExternalSiteUrl('about-us') which would then return something like /the/url/about-us. However, I can't seem to find a way to send a helper class parameters in a Layout XML file. I searched for other modules doing this already, and couldn't find one in the Customer module where I searched.
Can anyone help?
<block type="page/template_links" name="top.links" as="topLinks">
<action method="addLink">
<label>About Us</label>
<url helper="mymodule/getAboutUsUrl">
<arg>Now with more args!</arg>
<!-- will result in the string being passed as first arg -->
</url>
<title>About Us</title>
<prepare/>
<urlParams/>
<position>20</position>
</action>
</block>
Note that helpers do not extend Varien_Object
, therefore your method will need to explicitly define the getAboutUsUrl()
method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With