Skip to content

Commit

Permalink
feat(Form): add method to get position of element by element
Browse files Browse the repository at this point in the history
  • Loading branch information
micgro42 committed Mar 27, 2018
1 parent c6b5b74 commit 5facb9b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions inc/Form/Form.php
Expand Up @@ -78,6 +78,20 @@ public function elementCount() {
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
Expand Down

0 comments on commit 5facb9b

Please sign in to comment.