Rename Form::addElement to Form::createElement

Since we are using mainly createElement and addElement is only an alias for
createElement if no object is passed our changes to addElement can safely
be moved to createElement.

refs #5525
This commit is contained in:
Johannes Meyer 2014-07-23 10:57:46 +02:00
parent 25c9ee567d
commit 0bf0213547
1 changed files with 9 additions and 10 deletions

View File

@ -166,22 +166,21 @@ class Form extends Zend_Form
}
/**
* Add a new element
* Create a new element
*
* Additionally, all structural form element decorators by Zend are replaced with our own ones.
*
* @param string|Zend_Form_Element $element String element type, or an object of type Zend_Form_Element
* @param string $name The name of the element to add if $element is a string
* @param array $options The options for the element if $element is a string
* @param string $type String element type
* @param string $name The name of the element to add
* @param array $options The options for the element
*
* @return self
* @return Zend_Form_Element
*
* @see Zend_Form::addElement()
* @see Zend_Form::createElement()
*/
public function addElement($element, $name = null, $options = null)
public function createElement($type, $name, $options = null)
{
parent::addElement($element, $name, $options);
$el = $name !== null ? $this->getElement($name) : $element;
$el = parent::createElement($type, $name, $options);
if ($el) {
if (strpos(strtolower(get_class($el)), 'hidden') !== false) {
@ -195,7 +194,7 @@ class Form extends Zend_Form
}
}
return $this;
return $el;
}
/**