TYPO3 CMS  TYPO3_7-6
TcaFlexProcess.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 
29 {
40  public function addData(array $result)
41  {
42  foreach ($result['processedTca']['columns'] as $fieldName => $fieldConfig) {
43  if (empty($fieldConfig['config']['type']) || $fieldConfig['config']['type'] !== 'flex') {
44  continue;
45  }
46 
47  $flexIdentifier = $this->getFlexIdentifier($result, $fieldName);
48  $pageTsConfigOfFlex = $this->getPageTsOfFlex($result, $fieldName, $flexIdentifier);
49  $result = $this->modifyOuterDataStructure($result, $fieldName, $pageTsConfigOfFlex);
50  $result = $this->removeExcludeFieldsFromDataStructure($result, $fieldName, $flexIdentifier);
51  $result = $this->removeDisabledFieldsFromDataStructure($result, $fieldName, $pageTsConfigOfFlex);
52  $result = $this->modifyDataStructureAndDataValuesByFlexFormSegmentGroup($result, $fieldName, $pageTsConfigOfFlex);
53  $result = $this->addDataStructurePointersToMetaData($result, $fieldName);
54  }
55 
56  return $result;
57  }
58 
79  protected function getFlexIdentifier(array $result, $fieldName)
80  {
81  // @todo: Current implementation with the "list_type, CType" fallback is rather limited and customized for
82  // @todo: tt_content, also it forces a ds_pointerField to be defined and a casual "default" sub array does not work
83  $pointerFields = !empty($result['processedTca']['columns'][$fieldName]['config']['ds_pointerField'])
84  ? $result['processedTca']['columns'][$fieldName]['config']['ds_pointerField']
85  : 'list_type,CType';
86  $pointerFields = GeneralUtility::trimExplode(',', $pointerFields);
87  $flexformIdentifier = !empty($result['databaseRow'][$pointerFields[0]]) ? $result['databaseRow'][$pointerFields[0]] : '';
88  if (!empty($result['databaseRow'][$pointerFields[1]])
89  && $result['databaseRow'][$pointerFields[1]] !== 'list'
90  && $result['databaseRow'][$pointerFields[1]] !== '*'
91  ) {
92  $flexformIdentifier = $result['databaseRow'][$pointerFields[1]];
93  }
94  if (empty($flexformIdentifier)) {
95  $flexformIdentifier = 'default';
96  }
97 
98  return $flexformIdentifier;
99  }
100 
109  protected function getPageTsOfFlex(array $result, $fieldName, $flexIdentifier)
110  {
111  $table = $result['tableName'];
112  $pageTs = [];
113  if (!empty($result['pageTsConfig']['TCEFORM.'][$table . '.'][$fieldName . '.'][$flexIdentifier . '.'])
114  && is_array($result['pageTsConfig']['TCEFORM.'][$table . '.'][$fieldName . '.'][$flexIdentifier . '.'])) {
115  $pageTs = $result['pageTsConfig']['TCEFORM.'][$table . '.'][$fieldName . '.'][$flexIdentifier . '.'];
116  }
117  return $pageTs;
118  }
119 
129  protected function modifyOuterDataStructure(array $result, $fieldName, $pageTsConfig)
130  {
131  $modifiedDataStructure = $result['processedTca']['columns'][$fieldName]['config']['ds'];
132 
133  if (isset($modifiedDataStructure['sheets']) && is_array($modifiedDataStructure['sheets'])) {
134  // Handling multiple sheets
135  foreach ($modifiedDataStructure['sheets'] as $sheetName => $sheetStructure) {
136  if (isset($pageTsConfig[$sheetName . '.']) && is_array($pageTsConfig[$sheetName . '.'])) {
137  $pageTsOfSheet = $pageTsConfig[$sheetName . '.'];
138 
139  // Remove whole sheet if disabled
140  if (!empty($pageTsOfSheet['disabled'])) {
141  unset($modifiedDataStructure['sheets'][$sheetName]);
142  continue;
143  }
144 
145  // sheetTitle, sheetDescription, sheetShortDescr
146  $modifiedDataStructure['sheets'][$sheetName] = $this->modifySingleSheetInformation($sheetStructure, $pageTsOfSheet);
147  }
148  }
149  }
150 
151  $result['processedTca']['columns'][$fieldName]['config']['ds'] = $modifiedDataStructure;
152 
153  return $result;
154  }
155 
164  protected function removeExcludeFieldsFromDataStructure(array $result, $fieldName, $flexIdentifier)
165  {
166  $dataStructure = $result['processedTca']['columns'][$fieldName]['config']['ds'];
167  $backendUser = $this->getBackendUser();
168  if ($backendUser->isAdmin() || !isset($dataStructure['sheets']) || !is_array($dataStructure['sheets'])) {
169  return $result;
170  }
171 
172  $userNonExcludeFields = GeneralUtility::trimExplode(',', $backendUser->groupData['non_exclude_fields']);
173  $excludeFieldsPrefix = $result['tableName'] . ':' . $fieldName . ';' . $flexIdentifier . ';';
174  $nonExcludeFields = [];
175  foreach ($userNonExcludeFields as $userNonExcludeField) {
176  if (strpos($userNonExcludeField, $excludeFieldsPrefix) !== false) {
177  $exploded = explode(';', $userNonExcludeField);
178  $sheetName = $exploded[2];
179  $allowedFlexFieldName = $exploded[3];
180  $nonExcludeFields[$sheetName][$allowedFlexFieldName] = true;
181  }
182  }
183  foreach ($dataStructure['sheets'] as $sheetName => $sheetDefinition) {
184  if (!isset($sheetDefinition['ROOT']['el']) || !is_array($sheetDefinition['ROOT']['el'])) {
185  continue;
186  }
187  foreach ($sheetDefinition['ROOT']['el'] as $flexFieldName => $fieldDefinition) {
188  if (!empty($fieldDefinition['exclude']) && !isset($nonExcludeFields[$sheetName][$flexFieldName])) {
189  unset($result['processedTca']['columns'][$fieldName]['config']['ds']['sheets'][$sheetName]['ROOT']['el'][$flexFieldName]);
190  }
191  }
192  }
193 
194  return $result;
195  }
196 
205  protected function removeDisabledFieldsFromDataStructure(array $result, $fieldName, $pageTsConfig)
206  {
207  $dataStructure = $result['processedTca']['columns'][$fieldName]['config']['ds'];
208  if (!isset($dataStructure['sheets']) || !is_array($dataStructure['sheets'])) {
209  return $result;
210  }
211  foreach ($dataStructure['sheets'] as $sheetName => $sheetDefinition) {
212  if (!isset($sheetDefinition['ROOT']['el']) || !is_array($sheetDefinition['ROOT']['el'])
213  || !isset($pageTsConfig[$sheetName . '.'])) {
214  continue;
215  }
216  foreach ($sheetDefinition['ROOT']['el'] as $flexFieldName => $fieldDefinition) {
217  if (!empty($pageTsConfig[$sheetName . '.'][$flexFieldName . '.']['disabled'])) {
218  unset($result['processedTca']['columns'][$fieldName]['config']['ds']['sheets'][$sheetName]['ROOT']['el'][$flexFieldName]);
219  }
220  }
221  }
222  return $result;
223  }
224 
240  protected function modifyDataStructureAndDataValuesByFlexFormSegmentGroup(array $result, $fieldName, $pageTsConfig)
241  {
242  $dataStructure = $result['processedTca']['columns'][$fieldName]['config']['ds'];
243  $dataValues = $result['databaseRow'][$fieldName];
244  $tableName = $result['tableName'];
245 
246  if (!isset($dataStructure['sheets']) || !is_array($dataStructure['sheets'])) {
247  return $result;
248  }
249 
251  $formDataGroup = GeneralUtility::makeInstance(FlexFormSegment::class);
253  $formDataCompiler = GeneralUtility::makeInstance(FormDataCompiler::class, $formDataGroup);
254 
255  foreach ($dataStructure['sheets'] as $dataStructureSheetName => $dataStructureSheetDefinition) {
256  if (!isset($dataStructureSheetDefinition['ROOT']['el']) || !is_array($dataStructureSheetDefinition['ROOT']['el'])) {
257  continue;
258  }
259  $dataStructureSheetElements = $dataStructureSheetDefinition['ROOT']['el'];
260 
261  // Prepare pageTsConfig of this sheet
262  $pageTsConfig['TCEFORM.'][$tableName . '.'] = [];
263  if (isset($pageTsConfig[$dataStructureSheetName . '.']) && is_array($pageTsConfig[$dataStructureSheetName . '.'])) {
264  $pageTsConfig['TCEFORM.'][$tableName . '.'] = $pageTsConfig[$dataStructureSheetName . '.'];
265  }
266 
267  // It is possible to have a flex field field with of foreign_table (eg. type=select) that has markers in
268  // a foreign_table_where like ###PAGE_TSCONFIG_ID###. It was possible to set this in page TSConfig for flex fields like this:
269  // TCEFORM.theTable.theFlexfield.PAGE_TSCONFIG_ID = 42
270  // This hands over this PAGE_TSCONFIG_ID to all flex fields that have this foreign_table_where marker.
271  // This is a contradiction to the "usual" page TSConfig flex configuration that should be done for single flex fields:
272  // TCEFORM.theTable.theFlexfield.theDataStructure.theSheet.theField.PAGE_TSCONFIG_ID = 42
273  // The below code is a hack to still simulate the old behavior.
274  if (isset($result['pageTsConfig']['TCEFORM.'][$tableName . '.'][$fieldName . '.']['PAGE_TSCONFIG_ID'])) {
275  $pageTsConfig['flexHack.']['PAGE_TSCONFIG_ID'] = $result['pageTsConfig']['TCEFORM.'][$tableName . '.'][$fieldName . '.']['PAGE_TSCONFIG_ID'];
276  }
277  if (isset($result['pageTsConfig']['TCEFORM.'][$tableName . '.'][$fieldName . '.']['PAGE_TSCONFIG_IDLIST'])) {
278  $pageTsConfig['flexHack.']['PAGE_TSCONFIG_IDLIST'] = $result['pageTsConfig']['TCEFORM.'][$tableName . '.'][$fieldName . '.']['PAGE_TSCONFIG_IDLIST'];
279  }
280  if (isset($result['pageTsConfig']['TCEFORM.'][$tableName . '.'][$fieldName . '.']['PAGE_TSCONFIG_STR'])) {
281  $pageTsConfig['flexHack.']['PAGE_TSCONFIG_STR'] = $result['pageTsConfig']['TCEFORM.'][$tableName . '.'][$fieldName . '.']['PAGE_TSCONFIG_STR'];
282  }
283 
284  // List of "new" tca fields that have no value within the flexform, yet. Those will be compiled in one go later.
285  $tcaNewColumns = [];
286  // List of "edit" tca fields that have a value in flexform, already. Those will be compiled in one go later.
287  $tcaEditColumns = [];
288  // Contains the data values for the "edit" tca fields.
289  $tcaValueArray = [
290  'uid' => $result['databaseRow']['uid'],
291  ];
292  foreach ($dataStructureSheetElements as $dataStructureSheetElementName => $dataStructureSheetElementDefinition) {
293  if (isset($dataStructureSheetElementDefinition['type']) && $dataStructureSheetElementDefinition['type'] === 'array'
294  && isset($dataStructureSheetElementDefinition['section']) && (string)$dataStructureSheetElementDefinition['section'] === '1'
295  ) {
296  // A section
297 
298  // Existing section container elements
299  if (isset($dataValues['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]['el'])
300  && is_array($dataValues['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]['el'])
301  ) {
302  $containerArray = $dataValues['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]['el'];
303  foreach ($containerArray as $aContainerNumber => $aContainerArray) {
304  if (is_array($aContainerArray)) {
305  foreach ($aContainerArray as $aContainerName => $aContainerElementArray) {
306  if ($aContainerName === '_TOGGLE') {
307  // Don't handle internal toggle state field
308  continue;
309  }
310  if (!isset($dataStructureSheetElements[$dataStructureSheetElementName]['el'][$aContainerName])) {
311  // Container not defined in ds
312  continue;
313  }
314 
315  $newColumns = [];
316  $editColumns = [];
317  $valueArray = [
318  'uid' => $result['databaseRow']['uid'],
319  ];
320  foreach ($dataStructureSheetElements[$dataStructureSheetElementName]['el'][$aContainerName]['el'] as $singleFieldName => $singleFieldConfiguration) {
321  // $singleFieldValueArray = ['data']['sSections']['lDEF']['section_1']['el']['1']['container_1']['el']['element_1']
322  $singleFieldValueArray = [];
323  if (isset($aContainerElementArray['el'][$singleFieldName])
324  && is_array($aContainerElementArray['el'][$singleFieldName])
325  ) {
326  $singleFieldValueArray = $aContainerElementArray['el'][$singleFieldName];
327  }
328 
329  if (array_key_exists('vDEF', $singleFieldValueArray)) {
330  $editColumns[$singleFieldName] = $singleFieldConfiguration;
331  $valueArray[$singleFieldName] = $singleFieldValueArray['vDEF'];
332  } else {
333  $newColumns[$singleFieldName] = $singleFieldConfiguration;
334  }
335  }
336 
337  $inputToFlexFormSegment = [
338  'tableName' => $result['tableName'],
339  'command' => '',
340  // It is currently not possible to have pageTsConfig for section container
341  'pageTsConfig' => [],
342  'databaseRow' => $valueArray,
343  'processedTca' => [
344  'ctrl' => [],
345  'columns' => [],
346  ],
347  'flexParentDatabaseRow' => $result['databaseRow'],
348  ];
349 
350  if (!empty($newColumns)) {
351  $inputToFlexFormSegment['command'] = 'new';
352  $inputToFlexFormSegment['processedTca']['columns'] = $newColumns;
353  $flexSegmentResult = $formDataCompiler->compile($inputToFlexFormSegment);
354 
355  foreach ($newColumns as $singleFieldName => $_) {
356  // Set data value result
357  if (array_key_exists($singleFieldName, $flexSegmentResult['databaseRow'])) {
358  $result['databaseRow'][$fieldName]
359  ['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]
360  ['el'][$aContainerNumber][$aContainerName]['el'][$singleFieldName]['vDEF'] =
361  $flexSegmentResult['databaseRow'][$singleFieldName];
362  }
363  // Set TCA structure result, actually, this call *might* be obsolete since the "dummy"
364  // handling below will set it again.
365  $result['processedTca']['columns'][$fieldName]['config']['ds']
366  ['sheets'][$dataStructureSheetName]['ROOT']['el']
367  [$dataStructureSheetElementName]['el'][$aContainerName]['el'][$singleFieldName] =
368  $flexSegmentResult['processedTca']['columns'][$singleFieldName];
369  }
370  }
371 
372  if (!empty($editColumns)) {
373  $inputToFlexFormSegment['command'] = 'edit';
374  $inputToFlexFormSegment['processedTca']['columns'] = $editColumns;
375  $flexSegmentResult = $formDataCompiler->compile($inputToFlexFormSegment);
376 
377  foreach ($editColumns as $singleFieldName => $_) {
378  // Set data value result
379  if (array_key_exists($singleFieldName, $flexSegmentResult['databaseRow'])) {
380  $result['databaseRow'][$fieldName]
381  ['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]
382  ['el'][$aContainerNumber][$aContainerName]['el'][$singleFieldName]['vDEF'] =
383  $flexSegmentResult['databaseRow'][$singleFieldName];
384  }
385  // Set TCA structure result, actually, this call *might* be obsolete since the "dummy"
386  // handling below will set it again.
387  $result['processedTca']['columns'][$fieldName]['config']['ds']
388  ['sheets'][$dataStructureSheetName]['ROOT']['el']
389  [$dataStructureSheetElementName]['el'][$aContainerName]['el'][$singleFieldName] =
390  $flexSegmentResult['processedTca']['columns'][$singleFieldName];
391  }
392  }
393  }
394  }
395  }
396  // End of existing data value handling
397  } else {
398  // Force the section to be an empty array if there are no existing containers
399  $result['databaseRow'][$fieldName]
400  ['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]['el'] = [];
401  }
402 
403  // Prepare "fresh" row for every possible container
404  if (isset($dataStructureSheetElements[$dataStructureSheetElementName]['el']) && is_array($dataStructureSheetElements[$dataStructureSheetElementName]['el'])) {
405  foreach ($dataStructureSheetElements[$dataStructureSheetElementName]['el'] as $possibleContainerName => $possibleContainerConfiguration) {
406  if (isset($possibleContainerConfiguration['el']) && is_array($possibleContainerConfiguration['el'])) {
407  // Initialize result data array templateRows
408  $result['databaseRow'][$fieldName]
409  ['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]['templateRows']
410  [$possibleContainerName]['el']
411  = [];
412  foreach ($possibleContainerConfiguration['el'] as $singleFieldName => $singleFieldConfiguration) {
413 
414  // Nesting type=inline in container sections is not supported. Throw an exception if configured.
415  if (isset($singleFieldConfiguration['config']['type']) && $singleFieldConfiguration['config']['type'] === 'inline') {
416  throw new \UnexpectedValueException(
417  'Invalid flex form data structure on field name "' . $fieldName . '" with element "' . $singleFieldName . '"'
418  . ' in section container "' . $possibleContainerName . '": Nesting inline elements in flex form'
419  . ' sections is not allowed.',
420  1458745468
421  );
422  }
423 
424  // Nesting sections is not supported. Throw an exception if configured.
425  if (is_array($singleFieldConfiguration)
426  && isset($singleFieldConfiguration['type']) && $singleFieldConfiguration['type'] === 'array'
427  && isset($singleFieldConfiguration['section']) && (string)$singleFieldConfiguration['section'] === '1'
428  ) {
429  throw new \UnexpectedValueException(
430  'Invalid flex form data structure on field name "' . $fieldName . '" with element "' . $singleFieldName . '"'
431  . ' in section container "' . $possibleContainerName . '": Nesting sections in container elements'
432  . ' sections is not allowed.',
433  1458745712
434  );
435  }
436 
437  $inputToFlexFormSegment = [
438  'tableName' => $result['tableName'],
439  'command' => 'new',
440  'pageTsConfig' => [],
441  'databaseRow' => [
442  'uid' => $result['databaseRow']['uid'],
443  ],
444  'processedTca' => [
445  'ctrl' => [],
446  'columns' => [
447  $singleFieldName => $singleFieldConfiguration,
448  ],
449  ],
450  'flexParentDatabaseRow' => $result['databaseRow'],
451  ];
452  $flexSegmentResult = $formDataCompiler->compile($inputToFlexFormSegment);
453  if (array_key_exists($singleFieldName, $flexSegmentResult['databaseRow'])) {
454  $result['databaseRow'][$fieldName]
455  ['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]['templateRows']
456  [$possibleContainerName]['el'][$singleFieldName]['vDEF']
457  = $flexSegmentResult['databaseRow'][$singleFieldName];
458  }
459  $result['processedTca']['columns'][$fieldName]['config']['ds']
460  ['sheets'][$dataStructureSheetName]['ROOT']['el'][$dataStructureSheetElementName]['el']
461  [$possibleContainerName]['el'][$singleFieldName]
462  = $flexSegmentResult['processedTca']['columns'][$singleFieldName];
463  }
464  }
465  }
466  } // End of preparation for each possible container
467 
468  // type without section is not ok
469  } elseif (isset($dataStructureSheetElementDefinition['type']) || isset($dataStructureSheetElementDefinition['section'])) {
470  throw new \UnexpectedValueException(
471  'Broken data structure on field name ' . $fieldName . '. section without type or vice versa is not allowed',
472  1440685208
473  );
474 
475  // A "normal" TCA element
476  } else {
477  if (isset($dataValues['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName])
478  && array_key_exists('vDEF', $dataValues['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName])
479  ) {
480  $tcaEditColumns[$dataStructureSheetElementName] = $dataStructureSheetElementDefinition;
481  $tcaValueArray[$dataStructureSheetElementName] = $dataValues['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]['vDEF'];
482  } else {
483  $tcaNewColumns[$dataStructureSheetElementName] = $dataStructureSheetElementDefinition;
484  }
485  } // End of single element handling
486  }
487 
488  // process the tca columns for the current sheet
489  $inputToFlexFormSegment = [
490  // tablename of "parent" is given down for inline elements to resolve correctly
491  'tableName' => $result['tableName'],
492  'command' => '',
493  'pageTsConfig' => $pageTsConfig,
494  'databaseRow' => $tcaValueArray,
495  'processedTca' => [
496  'ctrl' => [],
497  'columns' => [],
498  ],
499  'flexParentDatabaseRow' => $result['databaseRow'],
500  ];
501 
502  if (!empty($tcaNewColumns)) {
503  $inputToFlexFormSegment['command'] = 'new';
504  $inputToFlexFormSegment['processedTca']['columns'] = $tcaNewColumns;
505  $flexSegmentResult = $formDataCompiler->compile($inputToFlexFormSegment);
506 
507  foreach ($tcaNewColumns as $dataStructureSheetElementName => $_) {
508  // Set data value result
509  if (array_key_exists($dataStructureSheetElementName, $flexSegmentResult['databaseRow'])) {
510  $result['databaseRow'][$fieldName]
511  ['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]['vDEF']
512  = $flexSegmentResult['databaseRow'][$dataStructureSheetElementName];
513  }
514  // Set TCA structure result
515  $result['processedTca']['columns'][$fieldName]['config']['ds']
516  ['sheets'][$dataStructureSheetName]['ROOT']['el'][$dataStructureSheetElementName]
517  = $flexSegmentResult['processedTca']['columns'][$dataStructureSheetElementName];
518  }
519  }
520 
521  if (!empty($tcaEditColumns)) {
522  $inputToFlexFormSegment['command'] = 'edit';
523  $inputToFlexFormSegment['processedTca']['columns'] = $tcaEditColumns;
524  $flexSegmentResult = $formDataCompiler->compile($inputToFlexFormSegment);
525 
526  foreach ($tcaEditColumns as $dataStructureSheetElementName => $_) {
527  // Set data value result
528  if (array_key_exists($dataStructureSheetElementName, $flexSegmentResult['databaseRow'])) {
529  $result['databaseRow'][$fieldName]
530  ['data'][$dataStructureSheetName]['lDEF'][$dataStructureSheetElementName]['vDEF']
531  = $flexSegmentResult['databaseRow'][$dataStructureSheetElementName];
532  }
533  // Set TCA structure result
534  $result['processedTca']['columns'][$fieldName]['config']['ds']
535  ['sheets'][$dataStructureSheetName]['ROOT']['el'][$dataStructureSheetElementName]
536  = $flexSegmentResult['processedTca']['columns'][$dataStructureSheetElementName];
537  }
538  }
539  }
540 
541  return $result;
542  }
543 
552  protected function modifySingleSheetInformation(array $dataStructure, array $pageTsOfSheet)
553  {
554  // Return if no elements defined
555  if (!isset($dataStructure['ROOT']['el']) || !is_array($dataStructure['ROOT']['el'])) {
556  return $dataStructure;
557  }
558 
559  // Rename sheet (tab)
560  if (!empty($pageTsOfSheet['sheetTitle'])) {
561  $dataStructure['ROOT']['sheetTitle'] = $pageTsOfSheet['sheetTitle'];
562  }
563  // Set sheet description (tab)
564  if (!empty($pageTsOfSheet['sheetDescription'])) {
565  $dataStructure['ROOT']['sheetDescription'] = $pageTsOfSheet['sheetDescription'];
566  }
567  // Set sheet short description (tab)
568  if (!empty($pageTsOfSheet['sheetShortDescr'])) {
569  $dataStructure['ROOT']['sheetShortDescr'] = $pageTsOfSheet['sheetShortDescr'];
570  }
571 
572  return $dataStructure;
573  }
574 
585  protected function addDataStructurePointersToMetaData(array $result, $fieldName)
586  {
587  if (empty($result['processedTca']['columns'][$fieldName]['config']['ds_pointerField'])) {
588  return $result;
589  }
590 
591  $pointerFields = GeneralUtility::trimExplode(
592  ',',
593  $result['processedTca']['columns'][$fieldName]['config']['ds_pointerField']
594  );
595  $dsPointers = [
596  $pointerFields[0] => !empty($result['databaseRow'][$pointerFields[0]]) ? $result['databaseRow'][$pointerFields[0]] : ''
597  ];
598 
599  if (!empty($pointerFields[1])) {
600  $dsPointers[$pointerFields[1]] =
601  !empty($result['databaseRow'][$pointerFields[1]]) ? $result['databaseRow'][$pointerFields[1]] : '';
602  }
603  $result['processedTca']['columns'][$fieldName]['config']['ds']['meta']['dataStructurePointers'] = $dsPointers;
604  return $result;
605  }
606 
610  protected function getBackendUser()
611  {
612  return $GLOBALS['BE_USER'];
613  }
614 }
removeExcludeFieldsFromDataStructure(array $result, $fieldName, $flexIdentifier)
static trimExplode($delim, $string, $removeEmptyValues=false, $limit=0)
modifySingleSheetInformation(array $dataStructure, array $pageTsOfSheet)
removeDisabledFieldsFromDataStructure(array $result, $fieldName, $pageTsConfig)
modifyOuterDataStructure(array $result, $fieldName, $pageTsConfig)
getPageTsOfFlex(array $result, $fieldName, $flexIdentifier)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']