<?php declare(strict_types = 0);
use Zabbix\Widgets\Fields\CWidgetFieldColumnsList;
$form = new CWidgetFormView($data);
$groupids_field = array_key_exists('groupids', $data['fields'])
? new CWidgetFieldMultiSelectGroupView($data['fields']['groupids'])
$hostids_field = $data['templateid'] === null
? (new CWidgetFieldMultiSelectHostView($data['fields']['hostids']))
'id' => $groupids_field->getId(),
'accept' => CMultiSelect::FILTER_PRESELECT_ACCEPT_ID,
->addField($groupids_field)
->addField($hostids_field)
->addField(array_key_exists('evaltype_host', $data['fields'])
? new CWidgetFieldRadioButtonListView($data['fields']['evaltype_host'])
->addField(array_key_exists('host_tags', $data['fields'])
? new CWidgetFieldTagsView($data['fields']['host_tags'])
(new CWidgetFieldPatternSelectItemView($data['fields']['items']))
->setFilterPreselect($hostids_field !== null
'id' => $hostids_field->getId(),
'accept' => CMultiSelect::FILTER_PRESELECT_ACCEPT_ID,
new CWidgetFieldRadioButtonListView($data['fields']['evaltype_item'])
new CWidgetFieldTagsView($data['fields']['item_tags'])
new CWidgetFieldCheckBoxView($data['fields']['maintenance'])
(new CWidgetFieldCheckBoxListView($data['fields']['show']))->setColumns(2)
(new CWidgetFormFieldsetCollapsibleView(_('Advanced configuration')))
getLabelFieldsGroupView($form, _('Primary label'), [
'label' => $data['fields']['primary_label'],
'label_bold' => $data['fields']['primary_label_bold'],
'label_color' => $data['fields']['primary_label_color'],
'label_decimal_places' => $data['fields']['primary_label_decimal_places'],
'label_size' => $data['fields']['primary_label_size'],
'label_size_type' => $data['fields']['primary_label_size_type'],
'label_type' => $data['fields']['primary_label_type'],
'label_units' => $data['fields']['primary_label_units'],
'label_units_pos' => $data['fields']['primary_label_units_pos'],
'label_units_show' => $data['fields']['primary_label_units_show']
])->addRowClass('fields-group-primary-label')