joomla/joomla-platform — Issue #426: Model's $_context is not passed to events
Author: Denitz
Created: 2011-10-12 17:34:44+00:00
State: open

Saving article from frontend launches onContentAfterSave() event where $context is 'com_content.form', backend launches this event with 'com_content.article'.

Frontend ContentModelArticle class declares its context as:
protected $_context = 'com_content.article';

But JModelAdmin doesn't use this value and uses this as context for all events:
$this->option.'.'.$this->name

I.e for JModelAdmin::save() method we have:
$dispatcher->trigger($this->event_after_save, array($this->option.'.'.$this->name, &$table, $isNew));

So saving article from frontend gives wrong context - 'com_content.form' instead of 'com_content.article'