/** * @param boolean $selected Whether to select (true) or unselect (false) this option. * * @return static */ public function setSelected($selected) { if ($selected) { $this->tag->setAttribute('selected', 'selected'); } else { $this->tag->removeAttribute('selected'); } return $this; }
/** * {@inheritdoc} */ protected function getTag() { if ($this->tag === null) { $this->tag = new ContainerTag('select'); if ($this->isArray()) { $this->tag->setAttribute('multiple', 'multiple'); } } return $this->tag; }
/** * @param \Brick\Form\Form $form * * @return string * * @throws \RuntimeException */ private function renderForm(Form $form) { $html = ''; foreach ($form->getComponents() as $component) { if ($component instanceof Element) { $html .= $this->renderElementAsRow($component); } elseif ($component instanceof Group) { foreach ($component->getElements() as $element) { $html .= $this->renderElementAsRow($element); } } } $table = new Tag('table'); $table->setAttribute('class', $this->class); $table->setHtmlContent($html); return $table->render(); }
/** * Renders the label. * * @return string */ public function render() { return $this->tag->setAttribute('for', $this->element->getId())->render(); }