parent
5485ca8a25
commit
c7a4098c04
|
@ -2,29 +2,41 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
use Zend_View_Helper_FormElement;
|
||||
|
||||
/**
|
||||
* Helper to generate a number input
|
||||
* Render number input controls
|
||||
*/
|
||||
class Zend_View_Helper_FormNumber extends \Zend_View_Helper_FormText
|
||||
class Zend_View_Helper_FormNumber extends Zend_View_Helper_FormElement
|
||||
{
|
||||
/**
|
||||
* Generates a html number input
|
||||
* Render the number input control
|
||||
*
|
||||
* @access public
|
||||
* @param string $name
|
||||
* @param int $value
|
||||
* @param array $attribs
|
||||
*
|
||||
* @param string $name The element name.
|
||||
* @param string $value The default value.
|
||||
* @param array $attribs Attributes which should be added to the input tag.
|
||||
*
|
||||
* @return string The input tag and options XHTML.
|
||||
* @return string The rendered number input control
|
||||
*/
|
||||
public function formNumber($name, $value = null, $attribs = null)
|
||||
{
|
||||
return '<input type="number"'
|
||||
. ' name="' . $this->view->escape($name) . '"'
|
||||
. ' value="' . $this->view->escape($value) . '"'
|
||||
. ' id="' . $this->view->escape($name) . '"'
|
||||
. $this->_htmlAttribs($attribs)
|
||||
. $this->getClosingBracket();
|
||||
$info = $this->_getInfo($name, $value, $attribs);
|
||||
extract($info); // name, id, value, attribs, options, listsep, disable
|
||||
/** @var string $id */
|
||||
/** @var bool $disable */
|
||||
$disabled = '';
|
||||
if ($disable) {
|
||||
$disabled = ' disabled="disabled"';
|
||||
}
|
||||
$html5 = sprintf(
|
||||
'<input type="number" name="%s" id="%s" value="%s"%s%s%s',
|
||||
$this->view->escape($name),
|
||||
$this->view->escape($id),
|
||||
$this->view->escape($value),
|
||||
$disabled,
|
||||
$this->_htmlAttribs($attribs),
|
||||
$this->getClosingBracket()
|
||||
);
|
||||
return $html5;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue