-
Notifications
You must be signed in to change notification settings - Fork 2
/
hooks.php
28 lines (19 loc) · 703 Bytes
/
hooks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
// Copyright 2024. WebPros International GmbH. All rights reserved.
require __DIR__ . '/vendor/autoload.php';
use WHMCS\Database\Capsule;
use WHMCS\Module\Server\Plesk360Monitoring\Constants;
use WHMCS\Module\Server\Plesk360Monitoring\CustomFields;
add_hook('ProductEdit', 1, function (array $vars) {
$productId = $vars['pid'] ?? null;
$serverType = $vars['servertype'] ?? null;
if (($productId === null) || ($serverType === null)) {
return [];
}
if ($serverType !== Constants::MODULE_NAME) {
return [];
}
$customFields = new CustomFields(Capsule::connection());
$customFields->addMissingProductCustomFields($productId);
return [];
});