View .md

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()

Name: featherpanel:admin:mounts:mount:createdemitted at 1 siteCancel or modify: nodefinition

Docblock: array mount data. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1mount_id$mountIdnot declared
2mount$mountnot declared
3created_by$createdBynot declared
When it fires (1 site)
$event->on(MountsEvent::onMountCreated(), function ($mountId, $mount, $createdBy): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:mounts:mount:created');
});

MountsEvent::onMountDeleted()

Name: featherpanel:admin:mounts:mount:deletedemitted at 1 siteCancel or modify: nodefinition

Docblock: int mount id, array mount data.

#Payload keyListener parameterType
1mount_id$mountIdint
2deleted_by$deletedByarrayfrom docblock
When it fires (1 site)
$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()

Name: featherpanel:admin:mounts:mount:updatedemitted at 1 siteCancel or modify: nodefinition

Docblock: int mount id, array mount data. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1mount_id$mountIdint
2mount$mountnot declared
3updated_by$updatedBynot declared
When it fires (1 site)
$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]));
});