View .md

SpellsEvent events

15 FeatherPanel plugin events on SpellsEvent (7 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. 8 of these events are declared but no code emits them yet; they are marked not emitted.

Setup

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

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(SpellsEvent::onSpellsReordered(), function ($realmId, $spells, $reorderedBy): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:reordered ' . json_encode(['realm_id' => $realmId, 'spells' => $spells, 'reordered_by' => $reorderedBy]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

SpellsEvent::onSpellsByRealmRetrieved()

Name: featherpanel:admin:spells:by:realm:retrievednot emittedCancel or modify: nodefinition

Docblock: int realm id, array spells.

$event->on(SpellsEvent::onSpellsByRealmRetrieved(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:by:realm:retrieved ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

SpellsEvent::onSpellsError()

Name: featherpanel:admin:spells:errornot emittedCancel or modify: nodefinition

Docblock: string error message, array context.

$event->on(SpellsEvent::onSpellsError(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:error ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

SpellsEvent::onSpellsReordered()

Name: featherpanel:admin:spells:reorderedemitted at 1 siteCancel or modify: nodefinition

Docblock: int realm id, array spells, array reordered_by.

#Payload keyListener parameterType
1realm_id$realmIdint
2spells$spellsarray
3reordered_by$reorderedByarrayfrom docblock
When it fires (1 site)
$event->on(SpellsEvent::onSpellsReordered(), function ($realmId, $spells, $reorderedBy): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:reordered ' . json_encode(['realm_id' => $realmId, 'spells' => $spells, 'reordered_by' => $reorderedBy]));
});

SpellsEvent::onSpellsRetrieved()

Name: featherpanel:admin:spells:retrievednot emittedCancel or modify: nodefinition

Docblock: array spells list.

$event->on(SpellsEvent::onSpellsRetrieved(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:retrieved ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

SpellsEvent::onSpellCreated()

Name: featherpanel:admin:spells:spell:createdemitted at 1 siteCancel or modify: nodefinition

Docblock: array spell data. (the emitter passes 2 values, see the table)

#Payload keyListener parameterType
1spell$spellnot declared
2created_by$createdBynot declared
When it fires (1 site)
$event->on(SpellsEvent::onSpellCreated(), function ($spell, $createdBy): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:spell:created');
});

SpellsEvent::onSpellDeleted()

Name: featherpanel:admin:spells:spell:deletedemitted at 1 siteCancel or modify: nodefinition

Docblock: int spell id, array spell data.

#Payload keyListener parameterType
1spell$spellintfrom docblock
2deleted_by$deletedByarrayfrom docblock
When it fires (1 site)
$event->on(SpellsEvent::onSpellDeleted(), function ($spell, $deletedBy): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:spell:deleted ' . json_encode(['spell' => $spell, 'deleted_by' => $deletedBy]));
});

SpellsEvent::onSpellExported()

Name: featherpanel:admin:spells:spell:exportednot emittedCancel or modify: nodefinition

Docblock: int spell id, array export data.

$event->on(SpellsEvent::onSpellExported(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:spell:exported ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

SpellsEvent::onSpellNotFound()

Name: featherpanel:admin:spells:spell:not:foundnot emittedCancel or modify: nodefinition

Docblock: int spell id, string error message.

$event->on(SpellsEvent::onSpellNotFound(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:spell:not:found ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

SpellsEvent::onSpellRetrieved()

Name: featherpanel:admin:spells:spell:retrievednot emittedCancel or modify: nodefinition

Docblock: int spell id, array spell data.

$event->on(SpellsEvent::onSpellRetrieved(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:spell:retrieved ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

SpellsEvent::onSpellUpdated()

Name: featherpanel:admin:spells:spell:updatedemitted at 1 siteCancel or modify: nodefinition

Docblock: int spell id, array old data, array new data.

#Payload keyListener parameterType
1spell$spellintfrom docblock
2updated_data$updatedDataarrayfrom docblock
3updated_by$updatedByarrayfrom docblock
When it fires (1 site)
$event->on(SpellsEvent::onSpellUpdated(), function ($spell, $updatedData, $updatedBy): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:spell:updated ' . json_encode(['spell' => $spell, 'updated_data' => $updatedData, 'updated_by' => $updatedBy]));
});

SpellsEvent::onSpellsImported()

Name: featherpanel:admin:spells:spells:importednot emittedCancel or modify: nodefinition

Docblock: array import data, array results.

$event->on(SpellsEvent::onSpellsImported(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:spells:imported ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

SpellsEvent::onSpellVariableCreated()

Name: featherpanel:admin:spells:variable:createdemitted at 1 siteCancel or modify: nodefinition

Docblock: int spell id, array variable data.

#Payload keyListener parameterType
1spell_id$spellIdint
2variable$variablearrayfrom docblock
When it fires (1 site)
$event->on(SpellsEvent::onSpellVariableCreated(), function ($spellId, $variable): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:variable:created ' . json_encode(['spell_id' => $spellId, 'variable' => $variable]));
});

SpellsEvent::onSpellVariableDeleted()

Name: featherpanel:admin:spells:variable:deletedemitted at 1 siteCancel or modify: nodefinition

Docblock: int variable id, array variable data. (the emitter passes 1 value, see the table)

#Payload keyListener parameterType
1variable$variablenot declared
When it fires (1 site)
$event->on(SpellsEvent::onSpellVariableDeleted(), function ($variable): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:variable:deleted');
});

SpellsEvent::onSpellVariableUpdated()

Name: featherpanel:admin:spells:variable:updatedemitted at 1 siteCancel or modify: nodefinition

Docblock: int variable id, array old data, array new data. (the emitter passes 2 values, see the table)

#Payload keyListener parameterType
1variable$variablenot declared
2updated_data$updatedDatanot declared
When it fires (1 site)
$event->on(SpellsEvent::onSpellVariableUpdated(), function ($variable, $updatedData): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:variable:updated');
});

SpellsEvent::onSpellVariablesRetrieved()

Name: featherpanel:admin:spells:variables:retrievednot emittedCancel or modify: nodefinition

Docblock: int spell id, array variables.

$event->on(SpellsEvent::onSpellVariablesRetrieved(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:spells:variables:retrieved ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.