當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


PHP WHMCS AdminPredefinedAddons用法及代碼示例

在加載 Create New Addon 頁麵時執行。

參數

變量 類型 注意
這個hook功能沒有參數。

響應

用於創建預定義插件麵板的值數組。請參閱數組結構的示例。

示例代碼

<?php

/**
 * Setting the 'icontype' value to 'fa' allows for the use of Font Awesome icons.
 */
add_hook('AdminPredefinedAddons', 1, function () {
    return [
        [
            'module' => 'yourmodule',
            'icontype' => 'fa',
            'iconvalue' => 'fad fa-cube',
            'labeltype' => 'success',
            'labelvalue' => 'Sample Label',
            'paneltitle' => 'Sample Title',
            'paneldescription' => 'Description to be displayed in the Predefined Addon panel.',
            'addonname' => 'On addon creation, this value will be used as the addon name.',
            'addondescription' => 'On addon creation, this value will be used as the addon description.',
            'welcomeemail' => 'Hosting Account Welcome Email',
            'featureaddon' => 'Name of feature addon as stored in the database.',
        ],
    ];
});

/**
 * Alternatively the 'icontype' value can be set to 'url' to allow for the use of URLs and file paths.
 */
add_hook('AdminPredefinedAddons', 1, function () {
    return [
        [
            'module' => 'yourmodule',
            'icontype' => 'url',
            'iconvalue' => 'https://www.whmcs.com/images/logo.png',
            'paneltitle' => 'Sample Title',
            'paneldescription' => 'Description to be displayed in the Predefined Addon panel.',
            'addonname' => 'On addon creation, this value will be used as the addon name.',
            'addondescription' => 'On addon creation, this value will be used as the addon description.',
            'featureaddon' => 'Name of feature addon as stored in the database.',
        ],
    ];
});

相關用法


注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 AdminPredefinedAddons。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。