Database Version 5.5.50
PHP Version 5.6.23
Web Server Apache
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.6.0 Stable
Plugin worked correctly until 3.5 was installed.
The plugin can be found on GitHub. The Amphenol Sensors branch was written for me, developer hasn't worked with Joomla for a while so didn't know of a solution.
Currently I have Conservative Caching disabled. And we're using the Plugin - System - Page Cache based on a workaround discussed on Stack Overflow.
JHTML::script instead of
->addScript. And other execution times besides
To rule out something else on the production site I sucessfully reproduced the issue on a clean install of Joomla 3.6.
Did you move:
$this->doc->addScript(JURI::base(true) . '/media/plg_customcontactform/js/form-actions.min.js');
to method onContentPrepareForm
Yes, I updated my question.
Then add jquery before that line.
IMHO this is not joomla bug.
You should go to forum.joomla.org if you can not resolve it yourself.
If you use something that requires jquery then you have to load jquery before (ex. line before).
This will change "chain".
Fair enough. I understand the concept. Migrating the script to
onBeforeRender and including the
onBeforeRender, (and I've seen it in tutorials) I'm still surprised at the outcome. Is there an actual reason (apparently undocumented) that caching does not work in this scenario.
TL:DR I'd still consider this a workaround as opposed to a fix at this juncture.
Oh, and to reiterate from my original post, the way the plugin was written functioned correctly before the release of Joomla 3.5.
Try something direct instead
Are you saying, instead of referencing the jQuery framework via JHtml, use an explicit addScript to add jQuery?
No Code Attached Yet
This is happening because when Caching is set to "Conservative", the component output is fetched from the cache, meaning any code from view.html.php is not executed. This includes the:
instructions. This plugin is a content plugin, and except on 1st page load, it's simply not loaded. Therefore it onBeforeRender handler is not registered and not executed.
I would think a content plugin should be allowed to insert js/css into the page head section and so content plugins should also be loaded when conservative caching is enabled. Not been able to pinpoint when this was changed around 3.5 release.
Maybe we have the app ensure content plugins are imported before
onAfterDispatch is dispatched?
|Closed_Date||0000-00-00 00:00:00||⇒||2017-06-06 18:58:59|
Seems to be the same issue, yes.Although the PR for that other issue touches different apects.