I have created a plugin that works using onContentAfterSave to fire off some other processing once a record is saved. This works as expected in the Back End but nothing gets triggered when I save a record in the front end.

The record I am saving is part of a custom component code, original coming from component creator some time ago if that may have something to do with it.

I can trap my plugin being triggered by core extensions like com_content when saving an article, the $context being com_content.form so I confirmed onContentAfterSave is available in the front end.

Looking through the site code I can see various components have triggers for onContentAfterSave or event_after_save which seems to be a new method but both comeback to this piece of code in AdminModel.php

if (isset($config['event_after_save']))
                $this->event_after_save = $config['event_after_save'];
            elseif (empty($this->event_after_save))
                $this->event_after_save = 'onContentAfterSave';

However I can't find any triggers being set in Front End libraries nor can I find other reference to code similar to above in frontend classes so I am assuming that someone how AdminModel.php is getting used by the FrontEnd at some stage or there is different approach for triggering being used in the frontEnd.

Following com_content I end up in class Table, ../libraries/src/Table/Table.php which has a couple of functions dealing with Observers that I think might be related but not sure and then this line in the store function

$this->_observers->update('onAfterStore', array(&$result));

All a bit lost now trying to understand if it is a new or different way and with J4 coming along what is the best approach to handle this for the future.

I could simply put a trigger somewhere in my code and move on, but I have been looking at this problem hours, getting near a day, trying to work out how it is working for com_content but not for my component.

Any pointers or explanations appreciated.


1 Answer 1


com_content frontend form model extends the backend model which in turn extends Joomla\CMS\MVC\Model\AdminModel. The backend model has a custom save() method where the event is triggered.

Meanwhile, your frontend form model extends Joomla\CMS\MVC\Model\FormModel which has no such event and no save() method. The simplest solution would be to trigger the event yourself in your model's save() method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.