gantry / gantry5

:rocket: Next Generation Template / Theme Framework
http://gantry.org
1.04k stars 204 forks source link

Gantry Issue with AJAX loader [Core Update Request] #2606

Open PageRankKings opened 4 years ago

PageRankKings commented 4 years ago

Gantry is having issues with some AJAX plugins. I was working on AJAX Infinity is a plugin for Joomla that replaces Joomla pagination with auto-loading infinite scroll. Instead of clicking on pagination links, you can now simply scroll down to reach more content. You can find this plugin here https://www.sakic.net/products/ajax-infinity/

I have been working on a fix with Emir Sakic who is one of Joomla's original developers. He found a solution and I would like to see if RocketTheme can get this as an update for core Gantry.

Gantry framework renders the Joomla component itself in this file: libraries/gantry5/classes/Gantry/Framework/Platform.php However, it doesn't trigger onBeforeRender() plugins that are required by AJAX Infinity. If you add this code to above file:

// Trigger the onBeforeRender event.
\JPluginHelper::importPlugin('system');
\JFactory::getApplication()->triggerEvent('onBeforeRender');

on line 255, just before:

$html = trim($renderer->render(null, $params, $content ?: $document->getBuffer('component')));

Kind regards,

mahagr commented 4 years ago

@PageRankKings Sorry for the delay.

I did some debugging and onBeforeRender() gets called by Joomla on every normal page load before Platform::displayContent() gets called. If I add the trigger to that method, it will cause the event to be fired two times, which unfortunately makes this not to be a proper fix. The method is there to just move component rendering out of the template file.

Unfortunately, I'm not able to test the plugin as it's a paid one. I have no idea how to get the event not to fire.