how to overwrite link_to in plugin
I have written a Joomla Component to include Symfony applications, as part oft his I'd like ot package up some files on the symfony side in a plugin. I can't find a way to overwrite link_to from within a plugin. Essentially what my modified link_to does in wrap the link into a Joomla request if 开发者_StackOverflow中文版called from the Joomla component.
You should created a copy of UrlHelper and save it in your with another name, say UrlCustomHelper. Inside your code instead of using use_helper('Url') you use use_helper('UrlCustom').
You don't get to overwrite it like you do with a method of a inherited class.
Either you copy the entire UrlHelper.php file with your modifications as you suggest, or you define a function with another name. There really aren't any other alternatives.
function joomla_link_to(...)
{
...
return link_to(...);
}
精彩评论