Skip to main content

Plugin Service

Namespace​

JobMetric\Extension\Services\Plugin

Facade​

use JobMetric\Extension\Facades\Plugin;

$fields = Plugin::fields('Module', 'Banner');
$rendered = Plugin::run($pluginId);

Create and Update Instances​

Use storeForExtension($extensionId, $data) and updateForExtension($extensionId, $pluginId, $data) when the installed extension ID is known. These methods apply the dynamic plugin request rules. Supply instance settings under fields and use only keys defined by the extension's form.

For an installed Banner that permits multiple instances:

use JobMetric\Extension\Facades\Plugin;

$result = Plugin::add('Module', 'Banner', [
'name' => 'Homepage banner',
'status' => true,
'fields' => [],
]);

The name is required and unique within the extension for multiple-instance types. Add values under fields when the driver declares them.

The convenience APIs add($type, $name, $fields) and edit($pluginId, $fields) address the same operations by type/name or plugin ID. Pass the optional owner to add() or fields() to disambiguate composed extensions.

Runtime​

run($pluginId) returns the driver's nullable string result. It returns null for a disabled instance or an unavailable driver. Authorize access to the instance in the host application before invoking it, and apply the appropriate escaping when rendering its output.