Nette\Forms\Rendering\DefaultFormRenderer::renderPair PHP Method

renderPair() public method

Renders single visual row.
public renderPair ( Nette\Forms\IControl $control ) : string
$control Nette\Forms\IControl
return string
    public function renderPair(Nette\Forms\IControl $control)
    {
        $pair = $this->getWrapper('pair container');
        $pair->addHtml($this->renderLabel($control));
        $pair->addHtml($this->renderControl($control));
        $pair->class($this->getValue($control->isRequired() ? 'pair .required' : 'pair .optional'), TRUE);
        $pair->class($control->hasErrors() ? $this->getValue('pair .error') : NULL, TRUE);
        $pair->class($control->getOption('class'), TRUE);
        if (++$this->counter % 2) {
            $pair->class($this->getValue('pair .odd'), TRUE);
        }
        $pair->id = $control->getOption('id');
        return $pair->render(0);
    }

Usage Example

Example #1
0
 public function renderPair(Nette\Forms\IControl $control)
 {
     $this->controlsInit();
     return parent::renderPair($control);
 }