/** * Renders 'label' part of visual row of controls. * @return string */ public function renderLabel(Nette\Forms\IControl $control) { $head = $this->getWrapper('label container'); if ($control instanceof Nette\Forms\Controls\Checkbox || $control instanceof Nette\Forms\Controls\Button) { return $head->setHtml($head->getName() === 'td' || $head->getName() === 'th' ? ' ' : ''); } else { $label = $control->getLabel(); $suffix = $this->getValue('label suffix') . ($control->isRequired() ? $this->getValue('label requiredsuffix') : ''); if ($label instanceof Html) { $label->setHtml($label->getHtml() . $suffix); $suffix = ''; } return $head->setHtml((string) $label . $suffix); } }
/** * Renders 'label' part of visual row of controls. * @return string */ public function renderLabel(Nette\Forms\IControl $control) { $suffix = $this->getValue('label suffix') . ($control->isRequired() ? $this->getValue('label requiredsuffix') : ''); $label = $control->getLabel(); if ($label instanceof Html) { $label->add($suffix); if ($control->isRequired()) { $label->class($this->getValue('control .required'), TRUE); } } elseif ($label != NULL) { // @intentionally == $label .= $suffix; } return $this->getWrapper('label container')->setHtml($label); }
Nette\InvalidArgumentException("Argument must be array of IFormControl instances.");}$s[]=(string)$control->getControl();}$pair=$this->getWrapper('pair container');$pair->add($this->renderLabel($control));$pair->add($this->getWrapper('control container')->setHtml(implode(" ",$s)));return$pair->render(0);}function renderLabel(Nette\Forms\IControl$control){$head=$this->getWrapper('label container');if($control instanceof Nette\Forms\Controls\Checkbox||$control instanceof Nette\Forms\Controls\Button){return$head->setHtml(($head->getName()==='td'||$head->getName()==='th')?' ':'');}else{$label=$control->getLabel();$suffix=$this->getValue('label suffix').($control->isRequired()?$this->getValue('label requiredsuffix'):'');if($label instanceof Html){$label->setHtml($label->getHtml().$suffix);$suffix='';}return$head->setHtml((string)$label.$suffix);}}function
/** * Renders 'label' part of visual row of controls. * @param \Nette\Forms\IControl $control * @return string */ public function renderLabel(\Nette\Forms\IControl $control) { if (!$control instanceof \Nette\Forms\Controls\Checkbox && !$control instanceof \Nette\Forms\Controls\Button) { if ($control->isRequired()) { $label = $control->getLabel(); $caption = $label->getText(); $required = \Nette\Utils\Html::el('small'); $required->setText($this->requiredLabel); $label->setHtml($caption . " " . (string) $required); return $label; } } return parent::renderLabel($control); }
/** * Renders 'control' part of visual row of controls. * @param \Nette\Forms\IControl $control * @return string */ public function renderControl(\Nette\Forms\IControl $control) { if ($control instanceof \Nette\Forms\Controls\Checkbox) { $html = $control->getLabel(); $caption = $html->getText(); $html->setHtml((string) $control->getControl() . " " . $caption); return (string) $html; } return parent::renderControl($control); }
/** * Renders 'control' part of visual row of controls. * @return string */ public function renderControl(Nette\Forms\IControl $control) { $body = $this->getWrapper('control container'); if ($this->counter % 2) { $body->class($this->getValue('control .odd'), TRUE); } $description = $control->getOption('description'); if ($description instanceof Html) { $description = ' ' . $description; } elseif (is_string($description)) { $description = ' ' . $this->getWrapper('control description')->setText($control->translate($description)); } else { $description = ''; } if ($control->isRequired()) { $description = $this->getValue('control requiredsuffix') . $description; } $el = $control->getControl(); if ($el instanceof Html && $el->getName() === 'input') { $el->class($this->getValue("control .{$el->type}"), TRUE); } if ($control instanceof Nette\Forms\Controls\Checkbox) { $el = $control->getLabel()->insert(0, $el); } return $body->setHtml($el . $description . $this->renderErrors($control)); }