jelix\forms\Builder\HtmlBuilder::outputHeader PHP Метод

outputHeader() публичный Метод

output the header content of the form
public outputHeader ( )
    public function outputHeader()
    {
        if (isset($this->options['attributes'])) {
            $attrs = $this->options['attributes'];
        } else {
            $attrs = array();
        }
        echo '<form';
        if (preg_match('#^https?://#', $this->_action)) {
            $urlParams = $this->_actionParams;
            $attrs['action'] = $this->_action;
        } else {
            $url = \jUrl::get($this->_action, $this->_actionParams, 2);
            // returns the corresponding jurl
            $urlParams = $url->params;
            $attrs['action'] = $url->getPath();
        }
        $attrs['method'] = $this->options['method'];
        $attrs['id'] = $this->_name;
        if ($this->_form->hasUpload()) {
            $attrs['enctype'] = "multipart/form-data";
        }
        $this->_outputAttr($attrs);
        echo '>';
        $this->rootWidget->outputHeader($this);
        $hiddens = '';
        foreach ($urlParams as $p_name => $p_value) {
            $hiddens .= '<input type="hidden" name="' . $p_name . '" value="' . htmlspecialchars($p_value) . '"' . $this->_endt . "\n";
        }
        foreach ($this->_form->getHiddens() as $ctrl) {
            if (!$this->_form->isActivated($ctrl->ref)) {
                continue;
            }
            $hiddens .= '<input type="hidden" name="' . $ctrl->ref . '" id="' . $this->_name . '_' . $ctrl->ref . '" value="' . htmlspecialchars($this->_form->getData($ctrl->ref)) . '"' . $this->_endt . "\n";
        }
        if ($this->_form->securityLevel) {
            $tok = $this->_form->createNewToken();
            $hiddens .= '<input type="hidden" name="__JFORMS_TOKEN__" value="' . $tok . '"' . $this->_endt . "\n";
        }
        if ($hiddens) {
            echo '<div class="jforms-hiddens">', $hiddens, '</div>';
        }
        $this->outputErrors();
    }