Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function render()
 {
     $content = '';
     foreach ($this->options as $option) {
         $content .= $option->render();
     }
     return $this->tag->setHtmlContent($content)->render();
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 protected function getTag()
 {
     if ($this->tag === null) {
         $this->tag = new ContainerTag('select');
         if ($this->isArray()) {
             $this->tag->setAttribute('multiple', 'multiple');
         }
     }
     return $this->tag;
 }
Esempio n. 3
0
 /**
  * Renders the errors of a Form or an Element as an unordered list.
  *
  * @param \Brick\Form\Base $base
  * @return string
  */
 private function renderErrors(Base $base)
 {
     if (!$base->hasErrors()) {
         return '';
     }
     $html = '';
     foreach ($base->getErrors() as $error) {
         $li = new Tag('li');
         $li->setTextContent($error);
         $html .= $li->render();
     }
     $ul = new Tag('ul');
     $ul->setHtmlContent($html);
     return $ul->render();
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function render()
 {
     return $this->tag->setTextContent($this->content)->render();
 }
Esempio n. 5
0
 /**
  * @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();
 }
Esempio n. 6
0
 /**
  * @param string $html
  *
  * @return static
  */
 public function setHtmlContent($html)
 {
     $this->tag->setHtmlContent($html);
     return $this;
 }
Esempio n. 7
0
File: Label.php Progetto: brick/form
 /**
  * Render the closing tag.
  *
  * @return string
  */
 public function close()
 {
     return $this->tag->renderClosingTag();
 }