/** * Converts the datalist to html code. * * @param string $prepend Optional string prepended to html content * @param string $append Optional string appended to html content * * @return string */ public function toHtml($prepend = '', $append = '') { //Do not print empty datalists if (!$this->count() && strlen($prepend . $append) === 0) { return ''; } return parent::toHtml($prepend, $append); }
/** * {@inheritdoc} */ public function offsetSet($offset, $value) { //Add the child to the parent if ($this->parent) { $this->parent->offsetSet($offset, $value); } //Add child to itself parent::offsetSet($offset, $value); }
/** * {@inheritdoc} */ public function html($html = null) { if ($html !== null) { parent::html($html); } $html = ''; //render the options not belonging to optgroups foreach ($this->children as $option) { if ($option->getParent() === $this) { $html .= (string) $option; } } //render the optgroups if (!empty($this->optgroups)) { foreach ($this->optgroups as $optgroup) { $html .= (string) $optgroup; } } return $html; }
/** * {@inheritdoc} * * @see ElementContainer::toHtml */ protected function defaultRender($prepend = '', $append = '') { return parent::toHtml($prepend, $append); }