Ticket #158 (new enhancement)

Opened 4 months ago

Solar_Form::getElementsByType()

Reported by: rodrigo.moraes@… Owned by: pmjones
Priority: trivial Component: code
Keywords: Solar_Form Cc:

Description

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. :-)

<?php
    /**
     * 
     * 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;
    }
?>

Attachments

Add/Change #158 (Solar_Form::getElementsByType())

Author



Action
as new
 
Note: See TracTickets for help on using tickets.