private function buildInputFilterFromForm(InputFilterInterface $inputFilter) : void
    {
        /** @var DOMElement $node */
        foreach ($this->getNodeList() as $name => $node) {
            if ($inputFilter->has($name)) {
                continue;
            }

            // Detect element type
            $type = $node->getAttribute('type');
            if ($node->tagName === 'textarea') {
                $type = 'textarea';
            } elseif ($node->tagName === 'select') {
                $type = 'select';
            }

            // Add validation
            if (array_key_exists($type, $this->formElements)) {
                $elementClass = $this->formElements[$type];
            } else {
                // Create a default validator
                $elementClass = $this->formElements['text'];
            }

            /** @var InputProviderInterface $element */
            $element = new $elementClass($node, $this->document);
            $input   = $this->factory->createInput($element);
            $inputFilter->add($input, $name);
        }
    }
private function buildInputFilterFromForm(InputFilterInterface $inputFilter) : void
    {
        /** @var DOMElement $node */
        foreach ($this->getNodeList() as $name => $node) {
            if ($inputFilter->has($name)) {
                continue;
            }

            // Detect element type
            $type = $node->getAttribute('type');
            if ($node->tagName === 'textarea') {
                $type = 'textarea';
            } elseif ($node->tagName === 'select') {
                $type = 'select';
            }

            // Add validation
            if (array_key_exists($type, $this->formElements)) {
                $elementClass = $this->formElements[$type];
            } else {
                // Create a default validator
                $elementClass = $this->formElements['text'];
            }

            /** @var InputProviderInterface $element */
            $element = new $elementClass($node, $this->document);
            $input   = $this->factory->createInput($element);
            $inputFilter->add($input, $name);
        }
    }
private function buildInputFilterFromForm ( InputFilterInterface $ inputFilter ) : void { /** @var DOMElement $node */ foreach ( $ this -> getNodeList ( ) as $ name => $ node ) { if ( $ inputFilter -> has ( $ name ) ) { continue ; } // Detect element type $ type = $ node -> getAttribute ( 'type' ) ; if ( $ node -> tagName === 'textarea' ) { $ type = 'textarea' ; } elseif ( $ node -> tagName === 'select' ) { $ type = 'select' ; } // Add validation if ( array_key_exists ( $ type , $ this -> formElements ) ) { $ elementClass = $ this -> formElements [ $ type ] ; } else { // Create a default validator $ elementClass = $ this -> formElements [ 'text' ] ; } /** @var InputProviderInterface $element */ $ element = new $ elementClass ( $ node , $ this -> document ) ; $ input = $ this -> factory -> createInput ( $ element ) ; $ inputFilter -> add ( $ input , $ name ) ; } }
Build the InputFilter, validators and filters from form fields
Build the InputFilter validators and filters from form fields