DnsHostsEvent events
3 FeatherPanel plugin events on DnsHostsEvent (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.
Setup
Import DnsHostsEvent 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\DnsHostsEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(DnsHostsEvent::onDnsHostDeleted(), function ($hostId, $host): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:dns_hosts:host:deleted ' . json_encode(['host_id' => $hostId, 'host' => $host]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}DnsHostsEvent::onDnsHostCreated()
Docblock: array host data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | host | $host | arrayfrom docblock |
When it fires (1 site)
DnsHostsController::createviaemitPluginEvent()PUT /api/admin/dns-hosts
$event->on(DnsHostsEvent::onDnsHostCreated(), function ($host): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:dns_hosts:host:created ' . json_encode(['host' => $host]));
});DnsHostsEvent::onDnsHostDeleted()
Docblock: int host id, array host data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | host_id | $hostId | int |
| 2 | host | $host | arrayfrom docblock |
When it fires (1 site)
DnsHostsController::deleteviaemitPluginEvent()DELETE /api/admin/dns-hosts/{id}
$event->on(DnsHostsEvent::onDnsHostDeleted(), function ($hostId, $host): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:dns_hosts:host:deleted ' . json_encode(['host_id' => $hostId, 'host' => $host]));
});DnsHostsEvent::onDnsHostUpdated()
Docblock: int host id, array host data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | host_id | $hostId | int |
| 2 | host | $host | arrayfrom docblock |
When it fires (1 site)
DnsHostsController::updateviaemitPluginEvent()PATCH /api/admin/dns-hosts/{id}
$event->on(DnsHostsEvent::onDnsHostUpdated(), function ($hostId, $host): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:dns_hosts:host:updated ' . json_encode(['host_id' => $hostId, 'host' => $host]));
});