/** * @return string */ public function render() { $html = ''; if (!is_null($this->labelElement)) { $html .= $this->labelElement->render(); } return $html . $this->elements->render(); }
/** * The HTML representation of this element wrapped in a label * * @return string */ public function toHTML() { if ($this->label) { return '<label ' . buildAttributes($this->label->attrs()) . '>' . DOKU_LF . '<span>' . hsc($this->label->val()) . '</span>' . DOKU_LF . $this->mainElementHTML() . DOKU_LF . '</label>'; } else { return $this->mainElementHTML(); } }
public function __construct($model, $attribute, $form = null, array $params = array()) { parent::__construct($model, $attribute, $form, $params); $this->attribute = 'pluralModuleLabels'; }
/** * Adds a label referencing another input element, allows HTML for content * * @param string $content * @param string|Element $for * @param int $pos * @return Element */ public function addLabelHTML($content, $for = '', $pos = -1) { $element = new LabelElement(hsc($content)); if (is_a($for, '\\dokuwiki\\Form\\Element')) { /** @var Element $for */ $for = $for->id(); } $for = (string) $for; if ($for !== '') { $element->attr('for', $for); } return $this->addElement($element, $pos); }