View .md

WebNodeEvent events

4 FeatherPanel plugin events on WebNodeEvent (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.

Setup

Import WebNodeEvent 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\WebNodeEvent;

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(WebNodeEvent::onWebNodeCreated(), function ($userUuid, $webNodeId, $webNode, $context): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:web:node:create ' . json_encode(['user_uuid' => $userUuid, 'web_node_id' => $webNodeId, 'web_node' => $webNode, 'context' => $context]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

WebNodeEvent::onWebNodeCreated()

Name: featherpanel:web:node:createemitted at 1 siteCancel or modify: nodefinition

Docblock: string|null user uuid, int web node id, array node payload, array context.

#Payload keyListener parameterType
1user_uuid$userUuidstring|nullfrom docblock
2web_node_id$webNodeIdint
3web_node$webNodearrayfrom docblock
4context$contextarray
When it fires (1 site)
$event->on(WebNodeEvent::onWebNodeCreated(), function ($userUuid, $webNodeId, $webNode, $context): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:web:node:create ' . json_encode(['user_uuid' => $userUuid, 'web_node_id' => $webNodeId, 'web_node' => $webNode, 'context' => $context]));
});

WebNodeEvent::onWebNodeDeleted()

Name: featherpanel:web:node:deleteemitted at 1 siteCancel or modify: nodefinition

Docblock: string|null user uuid, int web node id, array node payload, array context.

#Payload keyListener parameterType
1user_uuid$userUuidstring|nullfrom docblock
2web_node_id$webNodeIdint
3web_node$webNodearrayfrom docblock
4context$contextarray
When it fires (1 site)
$event->on(WebNodeEvent::onWebNodeDeleted(), function ($userUuid, $webNodeId, $webNode, $context): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:web:node:delete ' . json_encode(['user_uuid' => $userUuid, 'web_node_id' => $webNodeId, 'web_node' => $webNode, 'context' => $context]));
});

WebNodeEvent::onWebNodeKeyReset()

Name: featherpanel:web:node:key:resetemitted at 1 siteCancel or modify: nodefinition

Docblock: string|null user uuid, int web node id, array node payload, array context.

#Payload keyListener parameterType
1user_uuid$userUuidstring|nullfrom docblock
2web_node_id$webNodeIdint
3web_node$webNodearrayfrom docblock
4context$contextarray
When it fires (1 site)
$event->on(WebNodeEvent::onWebNodeKeyReset(), function ($userUuid, $webNodeId, $webNode, $context): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:web:node:key:reset ' . json_encode(['user_uuid' => $userUuid, 'web_node_id' => $webNodeId, 'web_node' => $webNode, 'context' => $context]));
});

WebNodeEvent::onWebNodeUpdated()

Name: featherpanel:web:node:updateemitted at 1 siteCancel or modify: nodefinition

Docblock: string|null user uuid, int web node id, array node payload, array changed fields, array context.

#Payload keyListener parameterType
1user_uuid$userUuidstring|nullfrom docblock
2web_node_id$webNodeIdint
3web_node$webNodearrayfrom docblock
4changed_fields$changedFieldsarray
5context$contextarray
When it fires (1 site)
$event->on(WebNodeEvent::onWebNodeUpdated(), function ($userUuid, $webNodeId, $webNode, $changedFields, $context): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:web:node:update ' . json_encode(['user_uuid' => $userUuid, 'web_node_id' => $webNodeId, 'web_node' => $webNode, 'changed_fields' => $changedFields, 'context' => $context]));
});