Skip to content

Instantly share code, notes, and snippets.

@ryandemmer
Created September 15, 2023 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryandemmer/fb85a09544e999b69ac59be86ccf9318 to your computer and use it in GitHub Desktop.
Save ryandemmer/fb85a09544e999b69ac59be86ccf9318 to your computer and use it in GitHub Desktop.
Sample system plugin
<?php
/**
* @copyright Copyright (C) 2023 Joe Public. All rights reserved
* @license GNU General Public License version 2 or later
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
class PlgSystemMy_Plugin extends CMSPlugin
{
public function onContentAfterSave($context, $article, $isNew): void
{
// Check we are handling the frontend edit form.
if ($context !== 'com_content.form') {
return;
}
// Check this is a new article.
if (!$isNew) {
return;
}
$app = Factory::getApplication();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment