Up to Joomla! 3.4.0 it was possible to change the document title in the code of a content plugin.
In Joomla! 3.4.0 content plugins were triggered with the following code
(line 163) $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$this->params, $offset));
Since Joomla! 3.4.1 the code was changeed to
(line 1643) $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$item->params, $offset));
So instead of &$this->params now &$item->params is used.
As $this->params is not set to the $item->params afterwards, changes made to the params in a content plugin are only available in the display function of the view class but not in the _prepareDocument function which actually does use the params.
The problem could be fixed by adding the following line to the display function after line 180
Regards,
Aicha
Did you try to use a different plugin event? Thing is that onContentAfterTitle
isn't really meant for such tasks. It is meant to return a string which is displayed after the title.
Labels |
Added:
?
|
Category | ⇒ | Plugins |
I used the onContentPrepare event which is not working, too.
If you like, I could send you my plugin to test with.
All onContent
events aren't meant to change the document itself. They are meant to deal with the content passed in.
You could probably set the document title in a later (system) event. If you need the $item you could do it using two events. One of the onContent...
events to fetch the needed data and a later one to alter the document title.
So this is an intended change in the interface? Because up to Joomla! 3.4.0 it worked with the onContent... events and that made a lot of sense to me. Which later event would you advice to use?
I'd say it was an intended change, yes. I would have to search the change though.
I would probably use https://docs.joomla.org/Plugin/Events/System#onBeforeRender.
Thanks, I'll check on that event but I would really appreciate if somebody would check if this really is an intended change or not because, as I wrote, it made perfectly sense to me to be able to change the document parameteres at that point, too.
Thanks for the information!
And yes, the onBeforeRender() event works perfectly for my purpose.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-07-13 10:20:09 |
Closed_By | ⇒ | avjoomla |
Do you have a plugin you can share that will help to make testing easier