Remove unused attributes from the date time picker element
This commit is contained in:
parent
a5990d4de8
commit
53091384cd
|
@ -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(
|
||||
'<input type="%s" name="%s" id="%s" step="1" value="%s"%s%s%s%s%s',
|
||||
'<input type="%s" name="%s" id="%s" step="1" value="%s"%s%s%s',
|
||||
$type,
|
||||
$this->view->escape($name),
|
||||
$this->view->escape($id),
|
||||
$this->view->escape($value),
|
||||
$min,
|
||||
$max,
|
||||
$disabled,
|
||||
$this->_htmlAttribs($attribs),
|
||||
$this->getClosingBracket()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue