View .md

MailHostsEvent events

3 FeatherPanel plugin events on MailHostsEvent (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 MailHostsEvent 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\MailHostsEvent;

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(MailHostsEvent::onMailHostDeleted(), function ($hostId, $host): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:mail_hosts:host:deleted ' . json_encode(['host_id' => $hostId, 'host' => $host]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

MailHostsEvent::onMailHostCreated()

Name: featherpanel:admin:mail_hosts:host:createdemitted at 1 siteCancel or modify: nodefinition

Docblock: array host data.

#Payload keyListener parameterType
1host$hostarrayfrom docblock
When it fires (1 site)
$event->on(MailHostsEvent::onMailHostCreated(), function ($host): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:mail_hosts:host:created ' . json_encode(['host' => $host]));
});

MailHostsEvent::onMailHostDeleted()

Name: featherpanel:admin:mail_hosts:host:deletedemitted at 1 siteCancel or modify: nodefinition

Docblock: int host id, array host data.

#Payload keyListener parameterType
1host_id$hostIdint
2host$hostarrayfrom docblock
When it fires (1 site)
$event->on(MailHostsEvent::onMailHostDeleted(), function ($hostId, $host): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:mail_hosts:host:deleted ' . json_encode(['host_id' => $hostId, 'host' => $host]));
});

MailHostsEvent::onMailHostUpdated()

Name: featherpanel:admin:mail_hosts:host:updatedemitted at 1 siteCancel or modify: nodefinition

Docblock: int host id, array host data.

#Payload keyListener parameterType
1host_id$hostIdint
2host$hostarrayfrom docblock
When it fires (1 site)
$event->on(MailHostsEvent::onMailHostUpdated(), function ($hostId, $host): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:mail_hosts:host:updated ' . json_encode(['host_id' => $hostId, 'host' => $host]));
});