function toHtml(array $htmlAttributes = array()) { Assert::isFalse(isset($htmlAttributes['name'])); Assert::isFalse(isset($htmlAttributes['multiple'])); $htmlAttributes['name'] = $this->getName() . '[]'; $htmlAttributes['multiple'] = 'multiple'; return HtmlUtil::getContainer('select', $htmlAttributes, join("", $this->getOptions())); }
/** * Gets the <option> tag as string * @param $value * @param $selected * @return string */ protected function getOption($value, $selected) { Assert::isScalarOrNull($value); Assert::isBoolean($selected); $attributes = array(); if ($value) { $attributes['value'] = $value; } if ($selected) { $attributes['selected'] = 'selected'; } return HtmlUtil::getContainer('option', $attributes, $this->getLabelFor($value)); }
function toHtml(array $htmlAttributes = array()) { Assert::isFalse(isset($htmlAttributes['name'])); $htmlAttributes['name'] = $this->getName(); return HtmlUtil::getContainer('textarea', $htmlAttributes, htmlspecialchars($this->getValue())); }