From 0bf021354764e34a7f084c4a8139e67905d3f48a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 23 Jul 2014 10:57:46 +0200 Subject: [PATCH] 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 --- library/Icinga/Web/Form.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index 4c57a6438..2440245b9 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -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; } /**