getGridFromTemplateFile() public method

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.
public getGridFromTemplateFile ( FluidTYPO3\Flux\View\ViewContext $viewContext, string $gridName = 'grid' ) : FluidTYPO3\Flux\Form\Container\Grid | null
$viewContext FluidTYPO3\Flux\View\ViewContext
$gridName string
return FluidTYPO3\Flux\Form\Container\Grid | null
 /**
  * @param array $row
  * @return Grid
  */
 public function getGrid(array $row)
 {
     if (NULL !== $this->grid) {
         return $this->grid;
     }
     $templatePathAndFilename = $this->getTemplatePathAndFilename($row);
     $section = $this->getConfigurationSectionName($row);
     $gridName = 'grid';
     $paths = $this->getTemplatePaths($row);
     $extensionKey = $this->getExtensionKey($row);
     $extensionName = ExtensionNamingUtility::getExtensionName($extensionKey);
     $fieldName = $this->getFieldName($row);
     $variables = $this->configurationService->convertFlexFormContentToArray($row[$fieldName]);
     $variables['record'] = $row;
     $grid = $this->configurationService->getGridFromTemplateFile($templatePathAndFilename, $section, $gridName, $paths, $extensionName, $variables);
     return $grid;
 }
Example #2
0
 /**
  * @param array $row
  * @return Grid
  */
 public function getGrid(array $row)
 {
     if (NULL !== $this->grid) {
         return $this->grid;
     }
     $gridName = 'grid';
     $cacheKey = $this->getCacheKeyForStoredVariable($row, $gridName);
     if (FALSE === array_key_exists($cacheKey, self::$cache)) {
         $viewContext = $this->getViewContext($row);
         $grid = $this->configurationService->getGridFromTemplateFile($viewContext, $gridName);
         self::$cache[$cacheKey] = $grid;
     }
     return self::$cache[$cacheKey];
 }
Example #3
0
 /**
  * @param array $row
  * @return Grid
  */
 public function getGrid(array $row)
 {
     if (NULL !== $this->grid) {
         return $this->grid;
     }
     $cacheKey = $this->getCacheKeyForStoredVariable($row, 'grid');
     if (FALSE === isset(self::$cache[$cacheKey])) {
         $class = get_class($this);
         $controllerName = substr(substr($class, strrpos($class, '\\') + 1), 0, -8);
         $templatePathAndFilename = $this->getTemplatePathAndFilename($row);
         $section = $this->getConfigurationSectionName($row);
         $gridName = 'grid';
         $paths = $this->getTemplatePaths($row);
         $extensionKey = $this->getExtensionKey($row);
         $extensionName = ExtensionNamingUtility::getExtensionName($extensionKey);
         $variables = $this->getViewVariables($row);
         $viewContext = new ViewContext($templatePathAndFilename, $extensionName, $controllerName);
         $viewContext->setTemplatePaths(new TemplatePaths($paths));
         $viewContext->setSectionName($section);
         $viewContext->setVariables($variables);
         $grid = $this->configurationService->getGridFromTemplateFile($viewContext, $gridName);
         self::$cache[$cacheKey] = $grid;
     }
     return self::$cache[$cacheKey];
 }