diff options
Diffstat (limited to 'ui/include/classes/widgets/fields/CWidgetFieldNumericBox.php')
-rw-r--r-- | ui/include/classes/widgets/fields/CWidgetFieldNumericBox.php | 48 |
1 files changed, 11 insertions, 37 deletions
diff --git a/ui/include/classes/widgets/fields/CWidgetFieldNumericBox.php b/ui/include/classes/widgets/fields/CWidgetFieldNumericBox.php index 4981289b46f..9aa6e68dcf6 100644 --- a/ui/include/classes/widgets/fields/CWidgetFieldNumericBox.php +++ b/ui/include/classes/widgets/fields/CWidgetFieldNumericBox.php @@ -1,4 +1,4 @@ -<?php +<?php declare(strict_types = 0); /* ** Zabbix ** Copyright (C) 2001-2022 Zabbix SIA @@ -19,50 +19,24 @@ **/ -/** - * Widget Field for numeric data. - */ +namespace Zabbix\Widgets\Fields; + +use Zabbix\Widgets\CWidgetField; + class CWidgetFieldNumericBox extends CWidgetField { - private $placeholder; - private $width; + public const DEFAULT_VALUE = ''; /** * A numeric box widget field. * Supported signed decimal values with suffix (KMGTsmhdw). - * - * @param string $name field name in form - * @param string $label label for the field in form */ - public function __construct($name, $label) { + public function __construct(string $name, string $label = null) { parent::__construct($name, $label); - $this->setSaveType(ZBX_WIDGET_FIELD_TYPE_STR); - $this->setValidationRules(['type' => API_NUMERIC, 'length' => 255]); - $this->setDefault(''); - } - - public function getMaxLength() { - return strlen((string) $this->max); - } - - public function setPlaceholder($placeholder) { - $this->placeholder = $placeholder; - - return $this; - } - - public function getPlaceholder() { - return $this->placeholder; - } - - public function setWidth($width) { - $this->width = $width; - - return $this; - } - - public function getWidth() { - return $this->width; + $this + ->setDefault(self::DEFAULT_VALUE) + ->setSaveType(ZBX_WIDGET_FIELD_TYPE_STR) + ->setValidationRules(['type' => API_NUMERIC, 'length' => 255]); } } |