From 53091384cd47c45f91c1e2534c3a4553d651820a Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 4 Jul 2017 10:32:30 +0200 Subject: [PATCH] Remove unused attributes from the date time picker element --- application/views/helpers/FormDateTime.php | 14 +--- .../Web/Form/Element/DateTimePicker.php | 77 ------------------- 2 files changed, 1 insertion(+), 90 deletions(-) diff --git a/application/views/helpers/FormDateTime.php b/application/views/helpers/FormDateTime.php index 77702f202..3b5ea7de0 100644 --- a/application/views/helpers/FormDateTime.php +++ b/application/views/helpers/FormDateTime.php @@ -46,26 +46,14 @@ class Zend_View_Helper_FormDateTime extends Zend_View_Helper_FormElement if (isset($attribs['placeholder']) && $attribs['placeholder'] instanceof DateTime) { $attribs['placeholder'] = $this->formatDate($attribs['placeholder'], $attribs['local']); } - $min = ''; - if (! empty($attribs['min'])) { - $min = sprintf(' min="%s"', $this->formatDate($attribs['min'], $attribs['local'])); - } - unset($attribs['min']); // Unset min to not render it again in $this->_htmlAttribs($attribs) - $max = ''; - if (! empty($attribs['max'])) { - $max = sprintf(' max="%s"', $this->formatDate($attribs['max'], $attribs['local'])); - } - unset($attribs['max']); // Unset max to not render it again in $this->_htmlAttribs($attribs) $type = $attribs['local'] === true ? 'datetime-local' : 'datetime'; unset($attribs['local']); // Unset local to not render it again in $this->_htmlAttribs($attribs) $html5 = sprintf( - 'view->escape($name), $this->view->escape($id), $this->view->escape($value), - $min, - $max, $disabled, $this->_htmlAttribs($attribs), $this->getClosingBracket() diff --git a/library/Icinga/Web/Form/Element/DateTimePicker.php b/library/Icinga/Web/Form/Element/DateTimePicker.php index 6a087b4ab..274c3b676 100644 --- a/library/Icinga/Web/Form/Element/DateTimePicker.php +++ b/library/Icinga/Web/Form/Element/DateTimePicker.php @@ -24,20 +24,6 @@ class DateTimePicker extends FormElement */ protected $local = true; - /** - * The expected lower bound for the element’s value - * - * @var DateTime|null - */ - protected $min; - - /** - * The expected upper bound for the element’s - * - * @var DateTime|null - */ - protected $max; - /** * (non-PHPDoc) * @see Zend_Form_Element::init() For the method documentation. @@ -48,69 +34,6 @@ class DateTimePicker extends FormElement new DateTimeValidator($this->local), true // true for breaking the validator chain on failure ); - if ($this->min !== null) { - $this->addValidator('GreaterThan', true, array('min' => $this->min)); - } - if ($this->max !== null) { - $this->addValidator('LessThan', true, array('max' => $this->max)); - } - } - - public function setLocal($local) - { - $this->local = (bool) $local; - return $this; - } - - public function getLocal() - { - return $this->local; - } - - /** - * Set the expected lower bound for the element’s value - * - * @param DateTime $min - * - * @return $this - */ - public function setMin(DateTime $min) - { - $this->min = $min; - return $this; - } - - /** - * Get the expected lower bound for the element’s value - * - * @return DateTime|null - */ - public function getMin() - { - return $this->min; - } - - /** - * Set the expected upper bound for the element’s value - * - * @param DateTime $max - * - * @return $this - */ - public function setMax(DateTime $max) - { - $this->max = $max; - return $this; - } - - /** - * Get the expected upper bound for the element’s value - * - * @return DateTime|null - */ - public function getMax() - { - return $this->max; } /**