Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solar_Form::getElementsByType() #7

Open
solarphp opened this issue Nov 27, 2010 · 0 comments
Open

Solar_Form::getElementsByType() #7

solarphp opened this issue Nov 27, 2010 · 0 comments

Comments

@solarphp
Copy link
Collaborator

This is a simple addition to Solar_Form: the ability to get a group of element infos by type. I use it to get the hidden elements from a form and although it can be implemented anywhere else, I think Solar_Form could offer such utility. :-)

/**
 * 
 * Returns all elements of a certain type.
 *
 * @param string $type The element type.
 * 
 * @return array List of elements.
 * 
 */
public function getElementsByType($type)
{
    $list = array();

    foreach ($this->elements as $name => $elem) {
        if($elem['type'] == $type) {
            $list[$name] = $elem;
        }
    }

    return $list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants