Skip to content
Snippets Groups Projects
Unverified Commit 5facb9bc authored by Michael Große's avatar Michael Große
Browse files

feat(Form): add method to get position of element by element

parent c6b5b74a
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment