Exemple #1
0
 /**
  * Creates a new Cell with the given content
  *
  * @param mixed $content    The content for the new Cell
  * @param array $attributes The attributes for the Cell
  *
  * @return Cell
  */
 protected function constructCell($content = null, $attributes = array())
 {
     $cell = new Cell($content);
     $cell->setAttributes($attributes);
     return $cell;
 }
Exemple #2
0
 protected function headerCell(Table\Cell $cell)
 {
     $html = '<th';
     $this->addAttributes($html, $cell->getAttributes());
     $html .= '>' . $cell->getContent() . '</th>';
     return $html;
 }
Exemple #3
0
 /**
  * Adds a fieldset object to the table.
  *
  * @param  Fieldset $fieldset
  *
  * @since 2.0
  */
 public function renderFieldset(Fieldset $fieldset)
 {
     // Create a new renderer and render the content
     $fieldsetRenderer = new static($this->csrfProvider);
     // Generate all the content
     foreach ($fieldset as $item) {
         $fieldsetRenderer->render($item);
     }
     $content = $fieldsetRenderer->getRenderedForm();
     // Create the fieldset tag and add the content
     $tag = Html::tag('fieldset', $fieldset->getAttributes(), $content);
     // Make sure everything is added to the parent table
     $cell = new Table\Cell($tag);
     $cell->setAttributes(['colspan' => 2]);
     $this->table->addCell($cell);
     $this->table->addRow();
     return '';
 }