NodesEvent events
9 FeatherPanel plugin events on NodesEvent (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. 6 of these events are declared but no code emits them yet; they are marked not emitted.
Setup
Import NodesEvent 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\NodesEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(NodesEvent::onNodeDeleted(), function ($node, $deletedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:node:deleted ' . json_encode(['node' => $node, 'deleted_by' => $deletedBy]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}NodesEvent::onNodesError()
Docblock: string error message, array context.
$event->on(NodesEvent::onNodesError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
NodesEvent::onNodeConnectionError()
Docblock: int node id, string error message.
$event->on(NodesEvent::onNodeConnectionError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:node:connection:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
NodesEvent::onNodeCreated()
Docblock: array node data. (the emitter passes 2 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | node | $node | not declared |
| 2 | created_by | $createdBy | not declared |
When it fires (2 sites)
$event->on(NodesEvent::onNodeCreated(), function ($node, $createdBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:node:created');
});NodesEvent::onNodeDeleted()
Docblock: int node id, array node data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | node | $node | intfrom docblock |
| 2 | deleted_by | $deletedBy | arrayfrom docblock |
When it fires (1 site)
$event->on(NodesEvent::onNodeDeleted(), function ($node, $deletedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:node:deleted ' . json_encode(['node' => $node, 'deleted_by' => $deletedBy]));
});NodesEvent::onNodeKeyReset()
Docblock: int node id, string new key.
$event->on(NodesEvent::onNodeKeyReset(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:node:key:reset ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
NodesEvent::onNodeNotFound()
Docblock: int node id, string error message.
$event->on(NodesEvent::onNodeNotFound(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:node:not:found ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
NodesEvent::onNodeRetrieved()
Docblock: int node id, array node data.
$event->on(NodesEvent::onNodeRetrieved(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:node:retrieved ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
NodesEvent::onNodeUpdated()
Docblock: int node id, array old data, array new data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | node | $node | intfrom docblock |
| 2 | updated_data | $updatedData | arrayfrom docblock |
| 3 | updated_by | $updatedBy | arrayfrom docblock |
When it fires (1 site)
$event->on(NodesEvent::onNodeUpdated(), function ($node, $updatedData, $updatedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:node:updated ' . json_encode(['node' => $node, 'updated_data' => $updatedData, 'updated_by' => $updatedBy]));
});NodesEvent::onNodesRetrieved()
Docblock: array nodes list.
$event->on(NodesEvent::onNodesRetrieved(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:nodes:retrieved ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.