diff --git a/inc/Form/Form.php b/inc/Form/Form.php index 2d534aee5cc9f9dd355549f7fa8513025a2b8f89..91e85d72abc9720ecfe97bfe10ef9571ec75d971 100644 --- a/inc/Form/Form.php +++ b/inc/Form/Form.php @@ -78,6 +78,20 @@ class Form extends Element { return count($this->elements); } + /** + * Get the position of the element in the form or false if it is not in the form + * + * Warning: This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. + * + * @param Element $element + * + * @return false|int + */ + public function getElementPosition(Element $element) + { + return array_search($element, $this->elements, true); + } + /** * Returns a reference to the element at a position. * A position out-of-bounds will return either the