setDefault(self::DEFAULT_VALUE) ->setValidationRules(['type' => API_STRINGS_UTF8]); } public function toApi(array &$widget_fields = []): void { $value = $this->getValue(); if ($value !== $this->default) { foreach ($value as $num => $val) { $widget_fields[] = [ 'type' => ZBX_WIDGET_FIELD_TYPE_STR, 'name' => $this->name.'.'.$num, 'value' => $val ]; } } } }