FluidTYPO3\Fluidpages\Backend\BackendLayoutDataProvider::getBackendLayoutConfiguration PHP Method

getBackendLayoutConfiguration() protected method

protected getBackendLayoutConfiguration ( integer $pageUid ) : array
$pageUid integer Starting page UID in the rootline (this current page)
return array
    protected function getBackendLayoutConfiguration($pageUid)
    {
        try {
            $record = $this->recordService->getSingle('pages', '*', $pageUid);
            // Stop processing if no fluidpages template configured in rootline
            if (null === $record) {
                return [];
            }
            $provider = $this->configurationService->resolvePageProvider($record);
            $action = $provider->getControllerActionFromRecord($record);
            if (true === empty($action)) {
                $this->configurationService->message('No template selected - backend layout will not be rendered', GeneralUtility::SYSLOG_SEVERITY_INFO);
                return [];
            }
            $grid = $provider->getGrid($record)->build();
            if (false === is_array($grid) || 0 === count($grid['rows'])) {
                // no grid is defined; we use the "raw" BE layout as a default behavior
                $this->configurationService->message('The selected page template does not contain a grid but the template is itself valid.');
                return [];
            }
        } catch (\Exception $error) {
            $this->configurationService->debug($error);
            return [];
        }
        $config = ['colCount' => 0, 'rowCount' => 0, 'rows.' => []];
        $rowIndex = 0;
        foreach ($grid['rows'] as $row) {
            $index = 0;
            $colCount = 0;
            $rowKey = $rowIndex + 1 . '.';
            $columns = [];
            foreach ($row['columns'] as $column) {
                $key = $index + 1 . '.';
                $columns[$key] = ['name' => $column['label'], 'colPos' => $column['colPos'] >= 0 ? $column['colPos'] : null];
                if ($column['colspan']) {
                    $columns[$key]['colspan'] = $column['colspan'];
                }
                if ($column['rowspan']) {
                    $columns[$key]['rowspan'] = $column['rowspan'];
                }
                $colCount += $column['colspan'] ? $column['colspan'] : 1;
                ++$index;
            }
            $config['colCount'] = max($config['colCount'], $colCount);
            $config['rowCount']++;
            $config['rows.'][$rowKey] = ['columns.' => $columns];
            ++$rowIndex;
        }
        if (false === $this->isPageModuleLanguageView()) {
            $config['rows.'][$rowIndex + 1 . '.'] = ['columns.' => ['1.' => ['name' => LocalizationUtility::translate('fluidContentArea', 'fluidpages'), 'colPos' => ContentService::COLPOS_FLUXCONTENT]]];
        }
        return $config;
    }