setDefault(self::DEFAULT_VALUE) ->setSaveType(ZBX_WIDGET_FIELD_TYPE_STR) ->setValidationRules([ 'type' => API_URL, 'flags' => API_ALLOW_USER_MACRO, 'length' => $this->max_length ]); } public function setFlags(int $flags): self { parent::setFlags($flags); if (($flags & self::FLAG_NOT_EMPTY) !== 0) { $strict_validation_rules = $this->getValidationRules(); self::setValidationRuleFlag($strict_validation_rules, API_NOT_EMPTY); $this->setStrictValidationRules($strict_validation_rules); } else { $this->setStrictValidationRules(); } return $this; } }