Lines Matching defs:element
78 #region element query function
91 * Get the position of the element in the form or false if it is not in the form
97 * @param Element $element
101 public function getElementPosition(Element $element)
103 return array_search($element, $this->elements, true);
107 * Returns a reference to the element at a position.
109 * first (underflow) or last (overflow) element.
123 * Gets the position of the first of a type of element
127 * @return false|int position of element if found, otherwise false
141 * Gets the position of the first element matching the attribute
146 * @return false|int position of element if found, otherwise false
164 * Adds or inserts an element to the form
166 * @param Element $element
170 public function addElement(Element $element, $pos = -1)
172 if (is_a($element, '\dokuwiki\Form\Form')) throw new \InvalidArgumentException(
176 $this->elements[] = $element;
178 array_splice($this->elements, $pos, 0, [$element]);
180 return $element;
184 * Replaces an existing element with a new one
186 * @param Element $element the new element
187 * @param int $pos 0-based position of the element to replace
189 public function replaceElement(Element $element, $pos)
191 if (is_a($element, '\dokuwiki\Form\Form')) throw new \InvalidArgumentException(
194 array_splice($this->elements, $pos, 1, [$element]);
198 * Remove an element from the form completely
200 * @param int $pos 0-based position of the element to remove
317 * Adds a label referencing another input element, escapes the label for you
330 * Adds a label referencing another input element, allows HTML for content
339 $element = new LabelElement($content);
347 $element->attr('for', $for);
350 return $this->addElement($element, $pos);
491 foreach ($this->elements as $element) {
492 $html .= $element->toHTML();