View .md

HostingPackagesEvent events

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

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(HostingPackagesEvent::onHostingPackageDeleted(), function ($packageId, $package): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:hosting_packages:package:deleted ' . json_encode(['package_id' => $packageId, 'package' => $package]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

HostingPackagesEvent::onHostingPackageCreated()

Name: featherpanel:admin:hosting_packages:package:createdemitted at 1 siteCancel or modify: nodefinition

Docblock: array package data.

#Payload keyListener parameterType
1package$packagearrayfrom docblock
When it fires (1 site)
$event->on(HostingPackagesEvent::onHostingPackageCreated(), function ($package): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:hosting_packages:package:created ' . json_encode(['package' => $package]));
});

HostingPackagesEvent::onHostingPackageDeleted()

Name: featherpanel:admin:hosting_packages:package:deletedemitted at 1 siteCancel or modify: nodefinition

Docblock: int package id, array package data.

#Payload keyListener parameterType
1package_id$packageIdint
2package$packagearrayfrom docblock
When it fires (1 site)
$event->on(HostingPackagesEvent::onHostingPackageDeleted(), function ($packageId, $package): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:hosting_packages:package:deleted ' . json_encode(['package_id' => $packageId, 'package' => $package]));
});

HostingPackagesEvent::onHostingPackageUpdated()

Name: featherpanel:admin:hosting_packages:package:updatedemitted at 1 siteCancel or modify: nodefinition

Docblock: int package id, array package data.

#Payload keyListener parameterType
1package_id$packageIdint
2package$packagearrayfrom docblock
When it fires (1 site)
$event->on(HostingPackagesEvent::onHostingPackageUpdated(), function ($packageId, $package): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:hosting_packages:package:updated ' . json_encode(['package_id' => $packageId, 'package' => $package]));
});