示例#1
0
 /**
  * Get or set the element's ID
  *
  * @param null|string $id
  * @return string|$this
  */
 public function id($id = null)
 {
     if ($this->label) {
         $this->label->attr('for', $id);
     }
     return parent::id($id);
 }
示例#2
0
 /**
  * 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);
 }