public function build() { $this->loadBlocks(); if (is_object($this->grid)) { echo $this->grid->parse(); } else { $this->context->getResponse()->sendError(\Innomatic\Webapp\WebAppResponse::SC_NOT_FOUND, $this->context->getRequest()->getRequestURI()); } }
/** * Adds a Block to the grid at the given position. * * @param Block $block Block object to be added at the grid * @param int $row Block row in the grid * @param int $column Block column in the grid * @param int $position Block position in the cell * * @return Grid grid object */ public function addBlock(Block $block, $row, $column, $position) { // Process the block and build the block HTML. $block->run($this->context->getRequest(), $this->context->getResponse()); // Set default row if not given. if (!$row) { $row = 1; } // Set default column it not given. if (!$column) { $column = 1; } // Set default position inside the cell if not given. if (!$position) { $position = 1; } // Set block name. $block_name = 'block_' . $row . '_' . $column . '_' . $position; $this->set($block_name, $block); $this->blocks[$row][$column][$position] = $block_name; return $this; }