registerField(new CWidgetFieldSelectView($data['fields']['column'])); $form ->addField($groupids) ->addField(array_key_exists('hostids', $data['fields']) ? (new CWidgetFieldMultiSelectHostView($data['fields']['hostids'], $data['captions']['hosts']['hostids'])) ->setFilterPreselect(['id' => $groupids->getId(), 'submit_as' => 'groupid']) : null ) ->addField(array_key_exists('evaltype', $data['fields']) ? new CWidgetFieldRadioButtonListView($data['fields']['evaltype']) : null ) ->addField(array_key_exists('tags', $data['fields']) ? new CWidgetFieldTagsView($data['fields']['tags']) : null ) ->addField( (new CWidgetFieldColumnsListView($data['fields']['columns']))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR) ) ->addField( new CWidgetFieldRadioButtonListView($data['fields']['order']) ) ->addItem([ $column->getLabel(), (new CFormField($data['fields']['column']->getValues() ? $column->getView() : _('Add item column'))) ->addClass($column->isDisabled() ? ZBX_STYLE_DISABLED : null) ]) ->addField(array_key_exists('show_lines', $data['fields']) ? new CWidgetFieldIntegerBoxView($data['fields']['show_lines']) : null ) ->includeJsFile('widget.edit.js.php') ->addJavaScript('widget_tophosts_form.init('.json_encode([ 'templateid' => $data['templateid'] ], JSON_THROW_ON_ERROR).');') ->show();