59 BackendLayout\DataProviderCollection::class
64 \
TYPO3\CMS\Backend\View\BackendLayout\DefaultDataProvider::class
67 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'BackendLayoutDataProvider'])) {
68 $dataProviders = (array)
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'BackendLayoutDataProvider'];
69 foreach ($dataProviders as $identifier => $className) {
102 $pageId = $this->
determinePageId($parameters[
'table'], $parameters[
'row']);
108 ->setData($parameters[
'row'])
109 ->setTableName($parameters[
'table'])
110 ->setFieldName($parameters[
'field'])
111 ->setPageTsConfig($pageTsConfig);
114 foreach ($backendLayoutCollections as $backendLayoutCollection) {
115 $combinedIdentifierPrefix =
'';
116 if ($backendLayoutCollection->getIdentifier() !==
'default') {
117 $combinedIdentifierPrefix = $backendLayoutCollection->getIdentifier() .
'__';
120 foreach ($backendLayoutCollection->getAll() as $backendLayout) {
121 $combinedIdentifier = $combinedIdentifierPrefix . $backendLayout->getIdentifier();
123 if (in_array($combinedIdentifier, $identifiersToBeExcluded,
true)) {
127 $parameters[
'items'][] = [
130 $backendLayout->getIconPath(),
145 if (strpos($data[
'uid'],
'NEW') === 0) {
149 if ($data[
'pid'] < 0) {
150 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
151 ->getQueryBuilderForTable($tableName);
152 $queryBuilder->getRestrictions()
154 $pageId = $queryBuilder
158 $queryBuilder->expr()->eq(
160 $queryBuilder->createNamedParameter(abs($data[
'pid']), \PDO::PARAM_INT)
166 $pageId = $data[
'pid'];
168 } elseif ($tableName ===
'pages') {
169 $pageId = $data[
'uid'];
171 $pageId = $data[
'pid'];
185 if (!isset($this->selectedCombinedIdentifier[$pageId])) {
187 $this->selectedCombinedIdentifier[$pageId] = (string)$page[
'backend_layout'];
189 if ($this->selectedCombinedIdentifier[$pageId] ===
'-1') {
191 $this->selectedCombinedIdentifier[$pageId] =
false;
192 } elseif ($this->selectedCombinedIdentifier[$pageId] ===
'' || $this->selectedCombinedIdentifier[$pageId] ===
'0') {
197 array_shift($rootLine);
198 array_pop($rootLine);
199 foreach ($rootLine as $rootLinePage) {
200 $this->selectedCombinedIdentifier[$pageId] = (string)$rootLinePage[
'backend_layout_next_level'];
201 if ($this->selectedCombinedIdentifier[$pageId] ===
'-1') {
203 $this->selectedCombinedIdentifier[$pageId] =
false;
206 if ($this->selectedCombinedIdentifier[$pageId] !==
'' && $this->selectedCombinedIdentifier[$pageId] !==
'0') {
214 return $this->selectedCombinedIdentifier[$pageId];
225 $identifiersToBeExcluded = [];
228 $identifiersToBeExcluded = GeneralUtility::trimExplode(
235 return $identifiersToBeExcluded;
247 $pageId = $this->
determinePageId($parameters[
'table'], $parameters[
'row']);
249 if ($pageId !==
false) {
264 if ($layout && $layout[
'__items']) {
265 $items = $layout[
'__items'];
279 $tcaConfig =
$GLOBALS[
'TCA'][
'tt_content'][
'columns'][
'colPos'][
'config'];
280 $tcaItems = $tcaConfig[
'items'];
281 $tcaItems = $this->
addItems($tcaItems, $tsConfig[
'addItems.']);
282 if (isset($tcaConfig[
'itemsProcFunc']) && $tcaConfig[
'itemsProcFunc']) {
285 if (!empty($tsConfig[
'removeItems'])) {
286 foreach (GeneralUtility::trimExplode(
',', $tsConfig[
'removeItems'],
true) as $removeId) {
287 foreach ($tcaItems as $key => $item) {
288 if ($item[1] == $removeId) {
289 unset($tcaItems[$key]);
308 protected function addItems($items, $iArray)
310 $languageService = static::getLanguageService();
311 if (is_array($iArray)) {
312 foreach ($iArray as $value => $label) {
315 if (is_array($label)) {
319 if (isset($iArray[$value .
'.']) && $iArray[$value .
'.'][
'icon']) {
320 $icon = $iArray[$value .
'.'][
'icon'];
324 $items[] = [$languageService->sL($label), $value, $icon];
338 if (isset($this->selectedBackendLayout[$pageId])) {
339 return $this->selectedBackendLayout[$pageId];
341 $backendLayoutData =
null;
351 if ($backendLayout ===
null) {
356 if (!empty($backendLayout)) {
358 $parser = GeneralUtility::makeInstance(TypoScriptParser::class);
360 $conditionMatcher = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher::class);
363 $backendLayoutData = [];
364 $backendLayoutData[
'config'] = $backendLayout->getConfiguration();
365 $backendLayoutData[
'__config'] =
$parser->setup;
366 $backendLayoutData[
'__items'] = [];
367 $backendLayoutData[
'__colPosList'] = [];
370 if (!empty($backendLayoutData[
'__config'][
'backend_layout.'][
'rows.'])) {
371 foreach ($backendLayoutData[
'__config'][
'backend_layout.'][
'rows.'] as $row) {
372 if (!empty($row[
'columns.'])) {
373 foreach ($row[
'columns.'] as $column) {
374 if (!isset($column[
'colPos'])) {
377 $backendLayoutData[
'__items'][] = [
382 $backendLayoutData[
'__colPosList'][] = $column[
'colPos'];
388 $this->selectedBackendLayout[$pageId] = $backendLayoutData;
391 return $backendLayoutData;
410 name = LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:colPos.I.1
426 protected function getPage($pageId)
428 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
429 ->getQueryBuilderForTable(
'pages');
430 $queryBuilder->getRestrictions()
432 $page = $queryBuilder
433 ->select(
'uid',
'pid',
'backend_layout')
436 $queryBuilder->expr()->eq(
438 $queryBuilder->createNamedParameter($pageId, \PDO::PARAM_INT)
464 return GeneralUtility::makeInstance(BackendLayout\DataProviderContext::class);
483 $columnName = $column[
'name'];
485 if (GeneralUtility::isFirstPartOfStr($columnName,
'LLL:')) {