Reference
Preset
A Preset contains reusable Widget configurations. Obtain one from Metrix's Presets service when a module needs to inspect or assemble a dashboard preset.
$preset = \verbb\metrix\Metrix::$plugin->getPresets()->getPresetByHandle('websiteOverview');
if (!$preset) {
throw new \RuntimeException('The websiteOverview Metrix Preset does not exist.');
}
Properties
The unique identifier for the preset, or null before it’s saved.
The name of the preset.
The handle of the preset.
Whether the preset is enabled.
The widgets the preset adds to a View when it’s applied.
Methods
Returns the preset’s widgets as widget objects.
Arguments: array $widgetConfigs
Normalises and assigns Widget instances or configuration arrays.
$preset->setWidgets([
[
'type' => \verbb\metrix\widgets\Counter::class,
'source' => 'analytics',
'canonicalMetric' => 'visitors',
'width' => 1,
],
]);
$widgets = $preset->getWidgets();
Last updated: Nov 13, 2026, 3:16:50 PM