Nette\Bridges\FormsLatte\Runtime::renderFormEnd PHP 메소드

renderFormEnd() 공개 정적인 메소드

Renders form end.
public static renderFormEnd ( Form $form, $withTags = TRUE ) : string
$form Nette\Forms\Form
리턴 string
    public static function renderFormEnd(Form $form, $withTags = TRUE)
    {
        $s = '';
        if ($form->isMethod('get')) {
            foreach (preg_split('#[;&]#', parse_url($form->getElementPrototype()->action, PHP_URL_QUERY), NULL, PREG_SPLIT_NO_EMPTY) as $param) {
                $parts = explode('=', $param, 2);
                $name = urldecode($parts[0]);
                if (!isset($form[$name])) {
                    $s .= Html::el('input', ['type' => 'hidden', 'name' => $name, 'value' => urldecode($parts[1])]);
                }
            }
        }
        foreach ($form->getControls() as $control) {
            if ($control->getOption('type') === 'hidden' && !$control->getOption('rendered')) {
                $s .= $control->getControl();
            }
        }
        if (iterator_count($form->getComponents(TRUE, Nette\Forms\Controls\TextInput::class)) < 2) {
            $s .= "<!--[if IE]><input type=IEbug disabled style=\"display:none\"><![endif]-->\n";
        }
        return $s . ($withTags ? $form->getElementPrototype()->endTag() . "\n" : '');
    }

Usage Example

예제 #1
0
 /** @deprecated */
 public static function renderFormEnd(Form $form, $withTags = TRUE)
 {
     echo Runtime::renderFormEnd($form, $withTags);
 }
All Usage Examples Of Nette\Bridges\FormsLatte\Runtime::renderFormEnd