Exemple #1
0
 /**
  * @param Collection $headerCells
  * @param Collection $bodyRows
  *
  * @return Text
  */
 protected function createView(Collection $headerCells, Collection $bodyRows)
 {
     $tHeadRow = new Tag('tr');
     $tHeadRow->setText("\n" . $headerCells->join("\n") . "\n");
     $tHead = new Tag('thead');
     $tHead->setText("\n" . $tHeadRow . "\n");
     $tBody = new Tag('tbody');
     $bodyRows->apply(function (Collection $row) use(&$options) {
         $tr = new Tag('tr');
         $tr->setText("\n" . $row->join("\n") . "\n");
         return $tr;
     });
     $tBody->setText("\n" . $bodyRows->join("\n") . "\n");
     $table = new Tag('table');
     $table->setAttributes(array('class' => 'table'));
     $table->setText("\n" . $tHead . "\n" . $tBody . "\n");
     return new Text($table->render());
 }
 /**
  * {@inheritdoc}
  */
 public function renderTag($tagName, $content, $tagType = Tag::TYPE_BLOCK, array $options = array())
 {
     $options = $this->createResolver()->resolve($options);
     $tag = new Tag($tagName);
     $tag->setType($tagType);
     $tag->setText($content);
     $tag->setAttributes($options['attr']);
     return $tag->render();
 }