User tests: Successful: Unsuccessful:
As extension dev, I like to do as less repetitive work as possible. This pr adds a base class extension devs can use to log actions more convenient. For example a plugin can then look like:
JLoader::import('com_actionlogs.libraries.actionlogplugin', JPATH_ADMINISTRATOR . '/components');
class PlgActionlogFoo extends ActionLogPlugin
{
public function onContentAfterSave($context, $item, $isNew)
{
if ($context != 'com_foo.bar')
{
return;
}
$message = array(
'action' => $isNew ? 'add' : 'update',
'type' => 'PLG_ACTIONLOG_FOO_TYPE_BAR',
'id' => $item->id,
'title' => $item->title,
'itemlink' => 'index.php?option=com_foo&task=edit&id=' . $item->id
);
$this->addLog(array($message), 'PLG_ACTIONLOG_FOO_' . $message['action'], $context);
}
}
Additionally it simplifies the default Joomla log plugin.
Save an article.
An action log is created.
An action log is created.
Document that a base class exists.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Front End Plugins |
Labels |
Added:
?
|
I have tested this item
Action log created after save
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC.
Note:
The plugin uses the list()
method which can be confusing depending on the php version.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-10-06 18:55:55 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
Done the changes.