View .md

AppEvent events

1 FeatherPanel plugin events on AppEvent (1 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.

Last synced from FeatherPanel 15b94e9 on .

On this page

Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions.

Setup

Import AppEvent in your entry class and register listeners in processEvents():

<?php

namespace App\Addons\myplugin;

use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\AppEvent;

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(AppEvent::onRouterReady(), function ($router): void {
            App::getInstance(true)->getLogger()->info('[myplugin] router::Ready');
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

AppEvent::onRouterReady()

Name: router::Readyemitted at 1 siteCancel or modify: nodefinition
#Payload keyListener parameterType
1router$routerRouteCollection
When it fires (1 site)
$event->on(AppEvent::onRouterReady(), function ($router): void {
    App::getInstance(true)->getLogger()->info('[myplugin] router::Ready');
});