Skip to content

Commit

Permalink
Add facade method for changing element priorities in FieldSet
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDotPro committed Jul 31, 2012
1 parent f2c408a commit 59ae800
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions library/Zend/Form/Fieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,21 @@ public function remove($elementOrFieldset)
return $this;
}

/**
* Set/change the priority of an element or fieldset
*
* @param string $elementOrFieldset
* @param int $priority
* @return FieldsetInterface
*/
public function setPriority($elementOrFieldset, $priority)
{
$element = $this->get($elementOrFieldset);
$this->remove($elementOrFieldset);
$this->add($element, array('priority' => $priority));
return $this;
}

/**
* Retrieve all attached elements
*
Expand Down
9 changes: 9 additions & 0 deletions library/Zend/Form/FieldsetInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ public function get($elementOrFieldset);
*/
public function remove($elementOrFieldset);

/**
* Set/change the priority of an element or fieldset
*
* @param string $elementOrFieldset
* @param int $priority
* @return FieldsetInterface
*/
public function setPriority($elementOrFieldset, $priority);

/**
* Retrieve all attached elements
*
Expand Down

0 comments on commit 59ae800

Please sign in to comment.