/**
  * Build the grid.
  *
  * @return Grid
  */
 public function build()
 {
     $grid = new Grid();
     foreach ($this->columns as $index => $column) {
         $grid->addColumn($column->build());
         $grid->addColumnResets($index, $column->getResets());
     }
     return $grid;
 }
 /**
  * Prepare the container by loading the grid and parse it as subcolumns definition.
  *
  * @param Grid $grid The grid object.
  *
  * @return array
  */
 protected function prepareContainer(Grid $grid)
 {
     $container = array();
     foreach ($grid->getColumns() as $column) {
         $container[] = array(implode(' ', $column));
     }
     return $container;
 }
Example #3
0
 /**
  * Build the column resets.
  *
  * @param \Database\Result $result The database result.
  * @param Grid             $grid   The grid being built.
  *
  * @return void
  */
 private static function buildColumnResets($result, $grid)
 {
     foreach (deserialize($result->resets, true) as $row) {
         foreach (array('xs', 'sm', 'md', 'lg') as $size) {
             if (isset($row[$size]) && $row[$size]) {
                 $grid->addColumnReset($row['column'] - 1, $size);
             }
         }
     }
 }