‪TYPO3CMS  9.5
TcaColumnsProcessPlaceholders.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 
19 
24 {
33  public function ‪addData(array $result)
34  {
35  foreach ($result['processedTca']['columns'] as $fieldName => $fieldConfig) {
36  // Placeholders are only valid for input and text type fields
37  if (
38  ($fieldConfig['config']['type'] !== 'input' && $fieldConfig['config']['type'] !== 'text')
39  || !isset($fieldConfig['config']['placeholder'])
40  ) {
41  continue;
42  }
43 
44  // Process __row|field type placeholders
45  if (strpos($fieldConfig['config']['placeholder'], '__row|') === 0) {
46  // split field names into array and remove the __row indicator
47  $fieldNameArray = array_slice(
48  GeneralUtility::trimExplode('|', $fieldConfig['config']['placeholder'], true),
49  1
50  );
51 
52  // only the first field is required to be processed as it's the one referring to
53  // the current record. All other columns will be resolved in a later pass through
54  // the related records.
55  if (!empty($fieldNameArray[0])) {
56  $result['columnsToProcess'][] = $fieldNameArray[0];
57  }
58  }
59  }
60 
61  return $result;
62  }
63 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessPlaceholders\addData
‪array addData(array $result)
Definition: TcaColumnsProcessPlaceholders.php:33
‪TYPO3\CMS\Backend\Form\FormDataProvider
Definition: AbstractDatabaseRecordProvider.php:2
‪TYPO3\CMS\Backend\Form\FormDataProviderInterface
Definition: FormDataProviderInterface.php:22
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessPlaceholders
Definition: TcaColumnsProcessPlaceholders.php:24