FluidTYPO3\Flux\Service\FluxService::getGridFromTemplateFile PHP Метод

getGridFromTemplateFile() публичный Метод

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
Результат FluidTYPO3\Flux\Form\Container\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;
    }

Usage Example

Пример #1
0
 /**
  * @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;
 }
All Usage Examples Of FluidTYPO3\Flux\Service\FluxService::getGridFromTemplateFile