/** * Returns the HTML representation of the element * * The method changes the element's name to foo[bar][] if it was foo[bar] * originally. If it is not done, then one of the click coordinates will be * lost, see {@link http://bugs.php.net/bug.php?id=745} * * @return string */ public function __toString() { if (false === strpos($this->attributes['name'], '[') || '[]' == substr($this->attributes['name'], -2)) { return parent::__toString(); } else { $this->attributes['name'] .= '[]'; $html = parent::__toString(); $this->attributes['name'] = substr($this->attributes['name'], 0, -2); return $html; } }
public function __toString() { if (0 == strlen($this->data['content'])) { $label = ''; } elseif ($this->frozen) { $label = $this->data['content']; } else { $label = '<label for="' . htmlspecialchars($this->getId(), ENT_QUOTES, self::getOption('charset')) . '">' . $this->data['content'] . '</label>'; } return parent::__toString() . $label; }