@@ -26,92 +26,92 @@ |
||
| 26 | 26 | class TcaGridAspect implements TableConfigurationPostProcessingHookInterface |
| 27 | 27 | { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Scans each data type of the TCA and add a Grid TCA if missing. |
|
| 31 | - * |
|
| 32 | - * @return array |
|
| 33 | - */ |
|
| 34 | - public function processData() |
|
| 35 | - { |
|
| 29 | + /** |
|
| 30 | + * Scans each data type of the TCA and add a Grid TCA if missing. |
|
| 31 | + * |
|
| 32 | + * @return array |
|
| 33 | + */ |
|
| 34 | + public function processData() |
|
| 35 | + { |
|
| 36 | 36 | |
| 37 | - /** @var ConfigurationUtility $configurationUtility */ |
|
| 38 | - $configurationUtility = $this->getObjectManager()->get(ConfigurationUtility::class); |
|
| 39 | - $configuration = $configurationUtility->getCurrentConfiguration('vidi'); |
|
| 37 | + /** @var ConfigurationUtility $configurationUtility */ |
|
| 38 | + $configurationUtility = $this->getObjectManager()->get(ConfigurationUtility::class); |
|
| 39 | + $configuration = $configurationUtility->getCurrentConfiguration('vidi'); |
|
| 40 | 40 | |
| 41 | - $dataTypes = GeneralUtility::trimExplode(',', $configuration['data_types']['value'], TRUE); |
|
| 41 | + $dataTypes = GeneralUtility::trimExplode(',', $configuration['data_types']['value'], TRUE); |
|
| 42 | 42 | |
| 43 | - foreach ($dataTypes as $dataType) { |
|
| 44 | - $this->ensureMinimumTcaForGrid($dataType); |
|
| 45 | - } |
|
| 43 | + foreach ($dataTypes as $dataType) { |
|
| 44 | + $this->ensureMinimumTcaForGrid($dataType); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return array($GLOBALS['TCA']); |
|
| 48 | - } |
|
| 47 | + return array($GLOBALS['TCA']); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param string $dataType |
|
| 52 | - */ |
|
| 53 | - protected function ensureMinimumTcaForGrid($dataType) |
|
| 54 | - { |
|
| 55 | - $labelField = $this->getLabelField($dataType); |
|
| 56 | - if (empty($GLOBALS['TCA'][$dataType]['grid'])) { |
|
| 57 | - $GLOBALS['TCA'][$dataType]['grid'] = array(); |
|
| 58 | - } |
|
| 50 | + /** |
|
| 51 | + * @param string $dataType |
|
| 52 | + */ |
|
| 53 | + protected function ensureMinimumTcaForGrid($dataType) |
|
| 54 | + { |
|
| 55 | + $labelField = $this->getLabelField($dataType); |
|
| 56 | + if (empty($GLOBALS['TCA'][$dataType]['grid'])) { |
|
| 57 | + $GLOBALS['TCA'][$dataType]['grid'] = array(); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - if (empty($GLOBALS['TCA'][$dataType]['grid']['facets'])) { |
|
| 61 | - $GLOBALS['TCA'][$dataType]['grid']['facets'] = [ |
|
| 62 | - 'uid', |
|
| 63 | - $labelField, |
|
| 64 | - ]; |
|
| 65 | - } |
|
| 60 | + if (empty($GLOBALS['TCA'][$dataType]['grid']['facets'])) { |
|
| 61 | + $GLOBALS['TCA'][$dataType]['grid']['facets'] = [ |
|
| 62 | + 'uid', |
|
| 63 | + $labelField, |
|
| 64 | + ]; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - if (empty($GLOBALS['TCA'][$dataType]['grid']['columns'])) { |
|
| 68 | - $GLOBALS['TCA'][$dataType]['grid']['columns'] = [ |
|
| 69 | - '__checkbox' => [ |
|
| 70 | - 'renderer' => new CheckBoxRenderer(), |
|
| 71 | - ], |
|
| 72 | - 'uid' => [ |
|
| 73 | - 'visible' => FALSE, |
|
| 74 | - 'label' => 'Id', |
|
| 75 | - 'width' => '5px', |
|
| 76 | - ], |
|
| 77 | - $labelField => [ |
|
| 78 | - 'editable' => TRUE, |
|
| 79 | - ], |
|
| 80 | - '__buttons' => [ |
|
| 81 | - 'renderer' => new ButtonGroupRenderer(), |
|
| 82 | - ], |
|
| 83 | - ]; |
|
| 84 | - } |
|
| 85 | - } |
|
| 67 | + if (empty($GLOBALS['TCA'][$dataType]['grid']['columns'])) { |
|
| 68 | + $GLOBALS['TCA'][$dataType]['grid']['columns'] = [ |
|
| 69 | + '__checkbox' => [ |
|
| 70 | + 'renderer' => new CheckBoxRenderer(), |
|
| 71 | + ], |
|
| 72 | + 'uid' => [ |
|
| 73 | + 'visible' => FALSE, |
|
| 74 | + 'label' => 'Id', |
|
| 75 | + 'width' => '5px', |
|
| 76 | + ], |
|
| 77 | + $labelField => [ |
|
| 78 | + 'editable' => TRUE, |
|
| 79 | + ], |
|
| 80 | + '__buttons' => [ |
|
| 81 | + 'renderer' => new ButtonGroupRenderer(), |
|
| 82 | + ], |
|
| 83 | + ]; |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Get the label name of table name. |
|
| 89 | - * |
|
| 90 | - * @param string $dataType |
|
| 91 | - * @return bool |
|
| 92 | - */ |
|
| 93 | - protected function getLabelField($dataType) |
|
| 94 | - { |
|
| 95 | - return $GLOBALS['TCA'][$dataType]['ctrl']['label']; |
|
| 96 | - } |
|
| 87 | + /** |
|
| 88 | + * Get the label name of table name. |
|
| 89 | + * |
|
| 90 | + * @param string $dataType |
|
| 91 | + * @return bool |
|
| 92 | + */ |
|
| 93 | + protected function getLabelField($dataType) |
|
| 94 | + { |
|
| 95 | + return $GLOBALS['TCA'][$dataType]['ctrl']['label']; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Tell whether the table has a label field. |
|
| 100 | - * |
|
| 101 | - * @param string $dataType |
|
| 102 | - * @return bool |
|
| 103 | - */ |
|
| 104 | - protected function hasLabelField($dataType) |
|
| 105 | - { |
|
| 106 | - return isset($GLOBALS['TCA'][$dataType]['ctrl']['label']); |
|
| 107 | - } |
|
| 98 | + /** |
|
| 99 | + * Tell whether the table has a label field. |
|
| 100 | + * |
|
| 101 | + * @param string $dataType |
|
| 102 | + * @return bool |
|
| 103 | + */ |
|
| 104 | + protected function hasLabelField($dataType) |
|
| 105 | + { |
|
| 106 | + return isset($GLOBALS['TCA'][$dataType]['ctrl']['label']); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * @return \TYPO3\CMS\Extbase\Object\ObjectManager |
|
| 111 | - */ |
|
| 112 | - protected function getObjectManager() |
|
| 113 | - { |
|
| 114 | - return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); |
|
| 115 | - } |
|
| 109 | + /** |
|
| 110 | + * @return \TYPO3\CMS\Extbase\Object\ObjectManager |
|
| 111 | + */ |
|
| 112 | + protected function getObjectManager() |
|
| 113 | + { |
|
| 114 | + return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | 117 | } |
| 118 | 118 | \ No newline at end of file |