fetches the setup for each of the columns
assigns a default setup if there is none available

@param string $layoutId The selected backend layout of the grid container

@return array The adjusted TypoScript setup for the container or a default setup
11548
public function getTypoScriptSetup($layoutId)
    {
        $typoScriptSetup = [];

        if ($layoutId == '0' && isset($this->typoScriptSetup['setup.']['default.'])) {
            $typoScriptSetup = $this->typoScriptSetup['setup.']['default.'];
        } elseif ($layoutId && isset($this->typoScriptSetup['setup.'][$layoutId . '.'])) {
            $typoScriptSetup = $this->typoScriptSetup['setup.'][$layoutId . '.'];
        } elseif ($layoutId) {
            $typoScriptSetup = $this->typoScriptSetup['setup.']['default.'];
        }

        // if there is none, we will use a reference to the tt_content setup as a default renderObj
        // without additional stdWrap functionality
        if (empty($typoScriptSetup)) {
            $typoScriptSetup['columns.']['default.']['renderObj'] = '<tt_content';
        }

        return $typoScriptSetup;
    }
716500
protected static function getConfigurationPageIdToUse($pageId)
    {
        $extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class);
        if ($extensionConfiguration->getIsUseConfigurationFromClosestTemplateEnabled()) {
            /** @var $configurationPageResolve ConfigurationPageResolver */
            $configurationPageResolver = GeneralUtility::makeInstance(ConfigurationPageResolver::class);
            $pageId = $configurationPageResolver->getClosestPageIdWithActiveTemplate($pageId);
            return $pageId;
        }
        return $pageId;
    }
46541
public function getLayoutSelectItems($colPos, $gridColPos = 0, $containerId = 0, $pageId = 0)
    {
        $allowed = ['*' => '*'];
        $disallowed = [];
        $selectItems = [];
        if ($containerId > 0) {
            $container = $this->cacheCurrentParent((int)$containerId, true);
            if (!empty($container)) {
                $containerLayout = $this->layoutSetup[$container['tx_gridelements_backend_layout']];
                $allowed = $containerLayout['allowed'][$gridColPos]['tx_gridelements_backend_layout'];
                $disallowed = $containerLayout['disallowed'][$gridColPos]['tx_gridelements_backend_layout'];
            }
        } elseif ($pageId > 0) {
            $pageLayout = Helper::getInstance()->getSelectedBackendLayout($pageId);
            if (!empty($pageLayout)) {
                $allowed = $pageLayout['allowed'][$colPos]['tx_gridelements_backend_layout'];
                $disallowed = $pageLayout['disallowed'][$colPos]['tx_gridelements_backend_layout'];
            }
        }
        foreach ($this->layoutSetup as $layoutId => $item) {
            if ((
                    (int)$colPos === -1 &&
                    $item['top_level_layout']
                ) ||
                (
                    !empty($allowed) &&
                    !isset($allowed['*']) &&
                    !isset($allowed[$layoutId])
                ) ||
                (
                    !empty($disallowed) &&
                    (
                        isset($disallowed['*']) ||
                        isset($disallowed[$layoutId])
                    )
                )) {
                continue;
            }
            $icon = 'gridelements-default';
            if ($item['iconIdentifier']) {
                $icon = $item['iconIdentifier'];
            } elseif (!empty($item['icon'])) {
                if (is_array($item['icon']) && !empty($item['icon'][0])) {
                    $icon = $item['icon'][0];
                } else {
                    $icon = $item['icon'];
                }
                if (StringUtility::beginsWith($icon, '../')) {
                    $icon = PATH_site . str_replace('../', '', $icon);
                }
            }
            $selectItems[] = [$this->languageService->sL($item['title']), $layoutId, $icon];
        }

        return $selectItems;
    }
1259140
public function loadLayoutData($layoutId, int $status): array
    {
        $query = $this->getLayoutSelectQuery();
        $query->where(
            $query->expr()->eq('l.id', ':id')
        )
        ->setParameter('id', $layoutId, Type::INTEGER);

        $this->applyStatusCondition($query, $status, 'l.status');

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
55516
public function getCampaignSettingsById($campaignId)
    {
        $results = [];
        if (
            $campaignId
            && isset($this->campaignSettings)
            && isset($this->campaignSettings->campaigns)
            && is_array($this->campaignSettings->campaigns)
        ) {
            // Note, there may be multiple matches for the same campaignId for future mapping purposes, so we aggregate.
            foreach ($this->campaignSettings->campaigns as $id => $campaign) {
                if (isset($campaign->campaignId) && $campaign->campaignId == $campaignId) {
                    $results[$id] = $campaign;
                }
            }
        }

        return $results;
    }
556600
public function getLayout($data = null) {
    $layout = null;

    // 1) Check the passed in data
    if (is_array($data) && array_key_exists(self::LAYOUT_KEY, $data)) {
      $layout = $data[self::LAYOUT_KEY];
      unset($data[self::LAYOUT_KEY]);
    }

    // 2) Check the data on the View
    if ($this->has(self::LAYOUT_KEY)) {
      $layout = $this->get(self::LAYOUT_KEY);
      $this->remove(self::LAYOUT_KEY);
    }

    // 3) Check the Slim configuration
    if (is_null($layout)) {
      $app = Slim::getInstance();
      if (isset($app)) {
        $layout = $app->config(self::LAYOUT_KEY);
      }
    }

    // 4) Use the default layout
    if (is_null($layout)) {
      $layout = self::DEFAULT_LAYOUT;
    }

    return $layout;
  }
1230773
public function getLayout($id)
    {
        if (!$this->_layoutsInitialized) {
            $this->_initLayout($id);
        }
        if (!isset($this->_layouts[$id])) {
            throw new Exception(__d('wasabi_cms', 'Layout "{0}" for theme "{1}" does not exist.', $id, $this->id()));
        }

        return $this->_layouts[$id];
    }
1130677
public function getLayoutColumnsSelectItems($layoutId)
    {
        $setup = $this->getLayoutSetup($layoutId);
        if (empty($setup['config']['rows.'])) {
            return [];
        }

        $selectItems = [];
        foreach ($setup['config']['rows.'] as $row) {
            if (empty($row['columns.'])) {
                continue;
            }
            foreach ($row['columns.'] as $column) {
                $selectItems[] = [
                    $this->languageService->sL($column['name']),
                    $column['colPos'],
                    null,
                    $column['allowed'] ? $column['allowed'] : '*',
                ];
            }
        }

        return $selectItems;
    }
1045478
public function deleteByLayoutId($layoutId): bool
    {
        $records = NavigationRecord::findAll(['layoutId' => $layoutId]);

        if ($records) {
            foreach ($records as $record) {
                if (!$record->delete()) {
                    return false;
                }
            }
        }

        return true;
    }
1314288
public function getWidgetMapByWidgetId($widgetId)
    {
        $widgetMap = null;

        $widgetMaps = $this->widgetMaps;

        //parse the widgets maps
        foreach ($widgetMaps as $wm) {
            if ($wm->getWidgetId() === $widgetId) {
                $widgetMap = $wm;
                //entity found, there is no need to continue
                break;
            }
        }

        return $widgetMap;
    }
102805
public function loadLayoutBlocksData(Layout $layout): array
    {
        $query = $this->getBlockSelectQuery();
        $query->where(
            $query->expr()->eq('b.layout_id', ':layout_id')
        )
        ->setParameter('layout_id', $layout->id, Type::INTEGER);

        $this->applyStatusCondition($query, $layout->status, 'b.status');

        return $query->execute()->fetchAll(PDO::FETCH_ASSOC);
    }
768851
public function init($pageId)
    {
        if (!$this->layoutSetup instanceof LayoutSetup) {
            $this->injectLayoutSetup(GeneralUtility::makeInstance(LayoutSetup::class)->init($pageId));
        }
    }
1345868
protected function getLayoutOptions($layout)
    {
        // If passed a layout, use that for any request.
        if (! is_null($layout)) {
            return [
                'default' => $layout,
                'ajax'    => $layout,
            ];
        }

        // If a set of layout options is defined, use those.
        if (isset($this->layoutOptions)) {
            return $this->layoutOptions;
        }

        // Use nothing.
        return null;
    }
352436
public function getBBCodes($setId = 1)
    {
        $set = $this->getSet($setId);
        $bbcodes = $set->getCodes();
        return $bbcodes;
    }
50372
public function getPerimetersConfiguration($siteId)
    {
        $perimetersConfiguration = array();
        foreach ($this->strategies as $strategy) {
            $perimetersConfiguration = array_merge(
                $perimetersConfiguration,
                array($strategy->getType() => $strategy->getPerimeterConfiguration($siteId))
            );
        }

        return $perimetersConfiguration;
    }
1053541
private function getComponentConfig(string $id): array
    {
        foreach ($this->storage[$id]['arguments'] as &$value) {
            $this->resolveComponent($value);
        }
        return $this->storage[$id];
    }
621550
public function getByHandle($layoutId, $handle)
    {
        $record = NavigationRecord::findOne([
            'layoutId' => $layoutId,
            'handle'   => $handle,
        ]);

        if ($record) {
            return new NavigationModel($record->getAttributes());
        }

        return null;
    }