MountsEvent events
3 FeatherPanel plugin events on MountsEvent (3 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 MountsEvent 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\MountsEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(MountsEvent::onMountDeleted(), function ($mountId, $deletedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:mounts:mount:deleted ' . json_encode(['mount_id' => $mountId, 'deleted_by' => $deletedBy]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}MountsEvent::onMountCreated()
Docblock: array mount data. (the emitter passes 3 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | mount_id | $mountId | not declared |
| 2 | mount | $mount | not declared |
| 3 | created_by | $createdBy | not declared |
When it fires (1 site)
MountsController::createviaemitPluginEvent()PUT /api/admin/mounts
$event->on(MountsEvent::onMountCreated(), function ($mountId, $mount, $createdBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:mounts:mount:created');
});MountsEvent::onMountDeleted()
Docblock: int mount id, array mount data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | mount_id | $mountId | int |
| 2 | deleted_by | $deletedBy | arrayfrom docblock |
When it fires (1 site)
MountsController::deleteviaemitPluginEvent()DELETE /api/admin/mounts/{id}
$event->on(MountsEvent::onMountDeleted(), function ($mountId, $deletedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:mounts:mount:deleted ' . json_encode(['mount_id' => $mountId, 'deleted_by' => $deletedBy]));
});MountsEvent::onMountUpdated()
Docblock: int mount id, array mount data. (the emitter passes 3 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | mount_id | $mountId | int |
| 2 | mount | $mount | not declared |
| 3 | updated_by | $updatedBy | not declared |
When it fires (1 site)
MountsController::updateviaemitPluginEvent()PATCH /api/admin/mounts/{id}
$event->on(MountsEvent::onMountUpdated(), function ($mountId, $mount, $updatedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:mounts:mount:updated ' . json_encode(['mount_id' => $mountId]));
});