PluginManagerEvent events
5 FeatherPanel plugin events on PluginManagerEvent (4 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. 1 of these events are declared but no code emits them yet; they are marked not emitted.
Setup
Import PluginManagerEvent 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\PluginManagerEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(PluginManagerEvent::onPluginFileCreated(), function ($identifier, $fileType, $fileData, $createdBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:plugin_manager:file:created ' . json_encode(['identifier' => $identifier, 'file_type' => $fileType, 'file_data' => $fileData]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}PluginManagerEvent::onPluginManagerError()
Docblock: string error message, array context.
$event->on(PluginManagerEvent::onPluginManagerError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:plugin_manager:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
PluginManagerEvent::onPluginFileCreated()
Docblock: string identifier, string file type, array file data. (the emitter passes 4 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | identifier | $identifier | string |
| 2 | file_type | $fileType | string |
| 3 | file_data | $fileData | array |
| 4 | created_by | $createdBy | not declared |
When it fires (3 sites)
$event->on(PluginManagerEvent::onPluginFileCreated(), function ($identifier, $fileType, $fileData, $createdBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:plugin_manager:file:created ' . json_encode(['identifier' => $identifier, 'file_type' => $fileType, 'file_data' => $fileData]));
});PluginManagerEvent::onPluginCreated()
Docblock: string identifier, array plugin data. (the emitter passes 3 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | identifier | $identifier | not declared |
| 2 | plugin_data | $pluginData | not declared |
| 3 | created_by | $createdBy | not declared |
When it fires (1 site)
$event->on(PluginManagerEvent::onPluginCreated(), function ($identifier, $pluginData, $createdBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:plugin_manager:plugin:created');
});PluginManagerEvent::onPluginUpdated()
Docblock: string identifier, array updated data. (the emitter passes 3 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | identifier | $identifier | not declared |
| 2 | updated_data | $updatedData | not declared |
| 3 | updated_by | $updatedBy | not declared |
When it fires (1 site)
$event->on(PluginManagerEvent::onPluginUpdated(), function ($identifier, $updatedData, $updatedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:plugin_manager:plugin:updated');
});PluginManagerEvent::onPluginSettingsUpdated()
Docblock: string identifier, array settings data. (the emitter passes 3 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | identifier | $identifier | not declared |
| 2 | settings | $settings | not declared |
| 3 | updated_by | $updatedBy | not declared |
When it fires (1 site)
$event->on(PluginManagerEvent::onPluginSettingsUpdated(), function ($identifier, $settings, $updatedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:plugin_manager:settings:updated');
});