Hi,
In my components I very often use plugins to handle the various trigger events sent by the Joomla framework all along the several workflows as save, delete etc..
It's a powerfull and clean way to achieve my aims without using dirty hacks.
However, a trigger event which allow to override list queries is sorely lacking.
It would be great to modify some component's queries whenever it's needed.
Such trigger is actually pretty easy to implement in the Joomla library.
In the libraries/src/MVC/Model/ListModel.php file at the end of the _getListQuery() function, just add the following:
protected function _getListQuery()
{
...
\JPluginHelper::importPlugin('content');
$dispatcher = \JEventDispatcher::getInstance();
$dispatcher->trigger('onContentAfterListQuery', array($this->context, $this->query));
return $this->query;
}
Then you just have to handle the event in your content plugin:
public function onContentAfterListQuery($context, $query)
{
//Do whatever you want here...
}
Would it be possible to add this trigger event in a future Joomla version ?
Where can I submit this proposal ?
Thanks