예제 #1
0
 /**
  * Reads a Grid constructed using flux:grid, returning an array of
  * defined rows and columns along with any content areas.
  *
  * Note about specific implementations:
  *
  * * EXT:fluidpages uses the Grid to render a BackendLayout on TYPO3 6.0 and above
  * * EXT:flux uses the Grid to render content areas inside content elements
  *   registered with Flux
  *
  * But your custom extension is of course allowed to use the Grid for any
  * purpose. You can even read the Grid from - for example - the currently
  * selected page template to know exactly how the BackendLayout looks.
  *
  * @param ViewContext $viewContext
  * @param string $gridName
  * @return Grid|NULL
  */
 public function getGridFromTemplateFile(ViewContext $viewContext, $gridName = 'grid')
 {
     $templatePathAndFilename = $viewContext->getTemplatePathAndFilename();
     $section = $viewContext->getSectionName();
     $grid = NULL;
     if (TRUE === file_exists($templatePathAndFilename)) {
         $exposedView = $this->getPreparedExposedTemplateView($viewContext);
         $exposedView->setTemplatePathAndFilename($templatePathAndFilename);
         $grid = $exposedView->getGrid($section, $gridName);
     }
     if (NULL === $grid) {
         $grid = Grid::create(array('name' => $gridName));
     }
     return $grid;
 }