. **/ namespace Zabbix\Widgets; use CApiInputValidator, DB; abstract class CWidgetField { public const DEFAULT_VIEW = null; public const FLAG_NOT_EMPTY = 0x02; public const FLAG_LABEL_ASTERISK = 0x04; public const FLAG_DISABLED = 0x08; public const FOREIGN_REFERENCE_KEY = '_reference'; public const REFERENCE_DASHBOARD = 'DASHBOARD'; protected string $name; protected ?string $label; protected ?string $label_prefix = null; protected ?int $save_type = null; protected $value; protected $default; protected array $values_captions = []; protected string $inaccessible_caption = ''; protected int $max_length; protected ?string $action = null; protected int $flags = 0x00; private array $validation_rules = []; private $templateid = null; private bool $default_prevented = false; private bool $widget_accepted = false; private bool $dashboard_accepted = false; private string $in_type = ''; /** * @param string $name Field name in form. * @param string|null $label Label for the field in form. */ public function __construct(string $name, string $label = null) { $this->name = $name; $this->label = $label; $this->value = null; $this->setSaveType(ZBX_WIDGET_FIELD_TYPE_STR); } public function getName(): string { return $this->name; } public function getLabel(): ?string { return $this->label; } /** * Prefix field label to enhance clarity in case of error messages. For example: * Invalid parameter "