RedirectLinksEvent events
7 FeatherPanel plugin events on RedirectLinksEvent (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.
Setup
Import RedirectLinksEvent 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\RedirectLinksEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(RedirectLinksEvent::onRedirectLinksError(), function ($error, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:redirect_links:error ' . json_encode(['error' => $error, 'context' => $context]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}RedirectLinksEvent::onRedirectLinksError()
Docblock: string error message, array context.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | error | $error | string |
| 2 | context | $context | array |
When it fires (3 sites)
$event->on(RedirectLinksEvent::onRedirectLinksError(), function ($error, $context): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:redirect_links:error ' . json_encode(['error' => $error, 'context' => $context]));
});RedirectLinksEvent::onRedirectLinkCreated()
Docblock: array link data. (the emitter passes 2 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | link_id | $linkId | int |
| 2 | link | $link | array |
When it fires (1 site)
$event->on(RedirectLinksEvent::onRedirectLinkCreated(), function ($linkId, $link): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:redirect_links:link:created ' . json_encode(['link_id' => $linkId, 'link' => $link]));
});RedirectLinksEvent::onRedirectLinkDeleted()
Docblock: int link id, array link data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | link_id | $linkId | int |
| 2 | link | $link | arrayfrom docblock |
When it fires (1 site)
$event->on(RedirectLinksEvent::onRedirectLinkDeleted(), function ($linkId, $link): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:redirect_links:link:deleted ' . json_encode(['link_id' => $linkId, 'link' => $link]));
});RedirectLinksEvent::onRedirectLinkNotFound()
Docblock: int link id, string error message.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | link_id | $linkId | int |
| 2 | error | $error | string |
When it fires (1 site)
$event->on(RedirectLinksEvent::onRedirectLinkNotFound(), function ($linkId, $error): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:redirect_links:link:not:found ' . json_encode(['link_id' => $linkId, 'error' => $error]));
});RedirectLinksEvent::onRedirectLinkRetrieved()
Docblock: int link id, array link data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | link_id | $linkId | int |
| 2 | link | $link | arrayfrom docblock |
When it fires (1 site)
$event->on(RedirectLinksEvent::onRedirectLinkRetrieved(), function ($linkId, $link): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:redirect_links:link:retrieved ' . json_encode(['link_id' => $linkId, 'link' => $link]));
});RedirectLinksEvent::onRedirectLinkUpdated()
Docblock: int link id, array old data, array new data. (the emitter passes 2 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | link_id | $linkId | int |
| 2 | link | $link | array |
When it fires (1 site)
$event->on(RedirectLinksEvent::onRedirectLinkUpdated(), function ($linkId, $link): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:redirect_links:link:updated ' . json_encode(['link_id' => $linkId, 'link' => $link]));
});RedirectLinksEvent::onRedirectLinksRetrieved()
Docblock: array links list. (the emitter passes 3 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | links | $links | not declared |
| 2 | page | $page | int |
| 3 | limit | $limit | int |
When it fires (1 site)
$event->on(RedirectLinksEvent::onRedirectLinksRetrieved(), function ($links, $page, $limit): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:redirect_links:retrieved ' . json_encode(['page' => $page, 'limit' => $limit]));
});