-
Verify the four required static properties exist at the top of src/Plugin.php:
public static $name = 'Your Plugin Name';
public static $description = 'What this plugin does';
public static $help = '';
public static $type = 'plugin';
Verify all four are public static before proceeding.
-
Register hooks in getHooks() by adding the event name → callback mapping. Uncomment or add entries:
public static function getHooks()
{
return [
'system.settings' => [__CLASS__, 'getSettings'],
'ui.menu' => [__CLASS__, 'getMenu'],
'function.requirements' => [__CLASS__, 'getRequirements'],
];
}
Only register hooks whose handler methods exist on the class. Verify the method names match exactly.
-
Implement getMenu() to add admin menu items with ACL guard:
public static function getMenu(GenericEvent $event)
{
$menu = $event->getSubject();
if ($GLOBALS['tf']->ima == 'admin') {
function_requirements('has_acl');
if (has_acl('client_billing')) {
}
}
}
The $menu object comes from $event->getSubject(). Only act when $GLOBALS['tf']->ima == 'admin'.
-
Implement getRequirements() to register page PHP files with the loader:
public static function getRequirements(GenericEvent $event)
{
$loader = $event->getSubject();
$loader->add_page_requirement(
'page_slug',
'/../vendor/detain/myadmin-payum-payments/src/page_slug.php'
);
}
The first argument is the page slug (no .php). The second is the path relative to webroot starting with /../vendor/detain/myadmin-payum-payments/src/. This step uses $loader from Step 4's $event->getSubject().
-
Implement getSettings() to receive the settings object:
public static function getSettings(GenericEvent $event)
{
$settings = $event->getSubject();
}
If no settings are needed, keep the method body as just $settings = $event->getSubject(); — the test testGetSettingsExtractsSubjectFromEvent calls this method and expects no exception.
-
Run tests to validate the structure:
vendor/bin/phpunit tests/PluginTest.php
All PluginTest cases must pass before considering the work done.