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()
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()
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()
Docblock: int realm id, array spells, array reordered_by.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | realm_id | $realmId | int |
| 2 | spells | $spells | array |
| 3 | reordered_by | $reorderedBy | arrayfrom 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()
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()
Docblock: array spell data. (the emitter passes 2 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | spell | $spell | not declared |
| 2 | created_by | $createdBy | not 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()
Docblock: int spell id, array spell data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | spell | $spell | intfrom docblock |
| 2 | deleted_by | $deletedBy | arrayfrom 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()
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()
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()
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()
Docblock: int spell id, array old data, array new data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | spell | $spell | intfrom docblock |
| 2 | updated_data | $updatedData | arrayfrom docblock |
| 3 | updated_by | $updatedBy | arrayfrom 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()
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()
Docblock: int spell id, array variable data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | spell_id | $spellId | int |
| 2 | variable | $variable | arrayfrom 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()
Docblock: int variable id, array variable data. (the emitter passes 1 value, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | variable | $variable | not 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()
Docblock: int variable id, array old data, array new data. (the emitter passes 2 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | variable | $variable | not declared |
| 2 | updated_data | $updatedData | not 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()
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.