addField( (new CWidgetFieldRadioButtonList('source_type', _('Source'), [ ZBX_WIDGET_FIELD_RESOURCE_GRAPH => _('Graph'), ZBX_WIDGET_FIELD_RESOURCE_SIMPLE_GRAPH => _('Simple graph') ])) ->setDefault(ZBX_WIDGET_FIELD_RESOURCE_GRAPH) ->setAction('ZABBIX.Dashboard.reloadWidgetProperties()') ) ->addField(array_key_exists('source_type', $this->values) && $this->values['source_type'] == ZBX_WIDGET_FIELD_RESOURCE_SIMPLE_GRAPH ? (new CWidgetFieldMultiSelectItem('itemid', _('Item'))) ->setFlags(CWidgetField::FLAG_NOT_EMPTY | CWidgetField::FLAG_LABEL_ASTERISK) ->setMultiple(false) : (new CWidgetFieldMultiSelectGraph('graphid', _('Graph'))) ->setFlags(CWidgetField::FLAG_NOT_EMPTY | CWidgetField::FLAG_LABEL_ASTERISK) ->setMultiple(false) ) ->addField( (new CWidgetFieldCheckBox('show_legend', _('Show legend')))->setDefault(1) ) ->addField($this->isTemplateDashboard() ? null : new CWidgetFieldCheckBox('dynamic', _('Enable host selection')) ); } }