FormSimpleNote: do not use "Note" from ZF

For compatibility reasons we'll not use 'note' anymore, it isn't part
of older Zend Framework versions

fixes #11297
This commit is contained in:
Thomas Gelf 2016-03-06 01:00:50 +01:00
parent ddba5c570c
commit 70db23b8d1
5 changed files with 29 additions and 3 deletions

View File

@ -84,7 +84,7 @@ class IcingaCommandArgumentForm extends DirectorObjectForm
protected function addCustomVariable($varname)
{
$a = new \Zend_Form_SubForm();
$a->addElement('note', 'title', array(
$a->addElement('simpleNote', 'title', array(
'label' => sprintf($this->translate('Custom Variable "%s"'), $varname),
));

View File

@ -0,0 +1,11 @@
<?php
class Zend_View_Helper_FormSimpleNote extends Zend_View_Helper_FormElement
{
public function formSimpleNote($name, $value = null)
{
$info = $this->_getInfo($name, $value);
extract($info); // name, value, attribs, options, listsep, disable
return $value;
}
}

View File

@ -77,7 +77,7 @@ abstract class DirectorObjectForm extends QuickForm
/*
// TODO implement when new logic is there
$this->addElement('note', '_newrange_hint', array('label' => 'New range'));
$this->addElement('simpleNote', '_newrange_hint', array('label' => 'New range'));
$this->addElement('text', '_newrange_name', array(
'label' => 'Name'
));

View File

@ -0,0 +1,15 @@
<?php
namespace Icinga\Module\Director\Web\Form\Element;
class SimpleNote extends FormElement
{
public $helper = 'formSimpleNote';
protected $_ignore = true;
public function isValid($value, $context = null)
{
return true;
}
}

View File

@ -246,7 +246,7 @@ abstract class QuickForm extends Zend_Form
public function addHtml($html, $options = array())
{
$name = '_HINT' . ++$this->hintCount;
$this->addElement('note', $name, $options);
$this->addElement('simpleNote', $name, $options);
$this->getElement($name)
->setValue($html)
->setIgnore(true)