protected function parseElements(array $elements)
    {
        // assume empty result
        $result = [];

        //@todo check input?

        // get count of inner elements
        $countElements = count($elements[1]);

        pred($elements);

        // iterate elements of <form>
        for ($j = 0; $j < $countElements; ++$j) {
            // get properties
            $element = $this->parsePropertiesFromHtml($elements[1][$j]);

            // rearrange them
            $element = $this->prepareStructureAndData($element);

            // check fieldname for existence of our own prefix so rip off
            $fieldName = (isset($element['properties']['name'])) ?
                substr($element['properties']['name'], 0, strlen(Doozr_Form_Service_Constant::PREFIX)) :
                '';

            if ($fieldName !== Doozr_Form_Service_Constant::PREFIX) {
                // get Id
                $id = $this->getId($element['properties']);

                // inject Id
                $element['properties']['id'] = $id;

                // get template identifier
                $templateIdentifier = $this->buildTemplateIdentifier(
                    $id,
                    isset($element['properties']['type']) ? $element['properties']['type'] : $element['tag']
                );

                $this->template = str_replace(
                    $elements[1][$j], // lookup
                    $templateIdentifier, // replace
                    $this->template // subject
                );

                // drop into result
                $result[] = $element;
            }
        }

        return $result;
    }
protected function parseElements(array $elements)
    {
        // assume empty result
        $result = [];

        //@todo check input?

        // get count of inner elements
        $countElements = count($elements[1]);

        pred($elements);

        // iterate elements of <form>
        for ($j = 0; $j < $countElements; ++$j) {
            // get properties
            $element = $this->parsePropertiesFromHtml($elements[1][$j]);

            // rearrange them
            $element = $this->prepareStructureAndData($element);

            // check fieldname for existence of our own prefix so rip off
            $fieldName = (isset($element['properties']['name'])) ?
                substr($element['properties']['name'], 0, strlen(Doozr_Form_Service_Constant::PREFIX)) :
                '';

            if ($fieldName !== Doozr_Form_Service_Constant::PREFIX) {
                // get Id
                $id = $this->getId($element['properties']);

                // inject Id
                $element['properties']['id'] = $id;

                // get template identifier
                $templateIdentifier = $this->buildTemplateIdentifier(
                    $id,
                    isset($element['properties']['type']) ? $element['properties']['type'] : $element['tag']
                );

                $this->template = str_replace(
                    $elements[1][$j], // lookup
                    $templateIdentifier, // replace
                    $this->template // subject
                );

                // drop into result
                $result[] = $element;
            }
        }

        return $result;
    }
protected function parseElements ( array $ elements ) { // assume empty result $ result = [ ] ; //@todo check input? // get count of inner elements $ countElements = count ( $ elements [ 1 ] ) ; pred ( $ elements ) ; // iterate elements of <form> for ( $ j = 0 ; $ j < $ countElements ; ++ $ j ) { // get properties $ element = $ this -> parsePropertiesFromHtml ( $ elements [ 1 ] [ $ j ] ) ; // rearrange them $ element = $ this -> prepareStructureAndData ( $ element ) ; // check fieldname for existence of our own prefix so rip off $ fieldName = ( isset ( $ element [ 'properties' ] [ 'name' ] ) ) ? substr ( $ element [ 'properties' ] [ 'name' ] , 0 , strlen ( Doozr_Form_Service_Constant :: PREFIX ) ) : '' ; if ( $ fieldName !== Doozr_Form_Service_Constant :: PREFIX ) { // get Id $ id = $ this -> getId ( $ element [ 'properties' ] ) ; // inject Id $ element [ 'properties' ] [ 'id' ] = $ id ; // get template identifier $ templateIdentifier = $ this -> buildTemplateIdentifier ( $ id , isset ( $ element [ 'properties' ] [ 'type' ] ) ? $ element [ 'properties' ] [ 'type' ] : $ element [ 'tag' ] ) ; $ this -> template = str_replace ( $ elements [ 1 ] [ $ j ] , // lookup $ templateIdentifier , // replace $ this -> template // subject ) ; // drop into result $ result [ ] = $ element ; } } return $ result ; }
Parses elements from passed array of elements-HTML.

@param array $elements The elements to use ...

@author Benjamin Carl <opensource@clickalicious.de>

@return array The resulting structure
Parses elements from passed array of elements - HTML .