@@ -19,49 +19,49 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class RelationEditRenderer extends ColumnRendererAbstract |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @return string |
|
| 24 | - */ |
|
| 25 | - public function render() |
|
| 26 | - { |
|
| 27 | - $output = ''; |
|
| 28 | - if ($this->isBackendMode()) { |
|
| 29 | - $output = $this->renderForBackend(); |
|
| 30 | - } |
|
| 22 | + /** |
|
| 23 | + * @return string |
|
| 24 | + */ |
|
| 25 | + public function render() |
|
| 26 | + { |
|
| 27 | + $output = ''; |
|
| 28 | + if ($this->isBackendMode()) { |
|
| 29 | + $output = $this->renderForBackend(); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - return $output; |
|
| 33 | - } |
|
| 32 | + return $output; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @return string |
|
| 37 | - */ |
|
| 38 | - protected function renderForBackend() |
|
| 39 | - { |
|
| 40 | - // Initialize url parameters array. |
|
| 41 | - $urlParameters = array( |
|
| 42 | - $this->getModuleLoader()->getParameterPrefix() => array( |
|
| 43 | - 'controller' => 'Content', |
|
| 44 | - 'action' => 'edit', |
|
| 45 | - 'matches' => array('uid' => $this->object->getUid()), |
|
| 46 | - 'fieldNameAndPath' => $this->getFieldName(), |
|
| 47 | - ), |
|
| 48 | - ); |
|
| 35 | + /** |
|
| 36 | + * @return string |
|
| 37 | + */ |
|
| 38 | + protected function renderForBackend() |
|
| 39 | + { |
|
| 40 | + // Initialize url parameters array. |
|
| 41 | + $urlParameters = array( |
|
| 42 | + $this->getModuleLoader()->getParameterPrefix() => array( |
|
| 43 | + 'controller' => 'Content', |
|
| 44 | + 'action' => 'edit', |
|
| 45 | + 'matches' => array('uid' => $this->object->getUid()), |
|
| 46 | + 'fieldNameAndPath' => $this->getFieldName(), |
|
| 47 | + ), |
|
| 48 | + ); |
|
| 49 | 49 | |
| 50 | - $fieldLabel = Tca::table()->field($this->getFieldName())->getLabel(); |
|
| 51 | - if ($fieldLabel) { |
|
| 52 | - $fieldLabel = str_replace(':', '', $fieldLabel); // sanitize label |
|
| 53 | - } |
|
| 50 | + $fieldLabel = Tca::table()->field($this->getFieldName())->getLabel(); |
|
| 51 | + if ($fieldLabel) { |
|
| 52 | + $fieldLabel = str_replace(':', '', $fieldLabel); // sanitize label |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - return sprintf( |
|
| 56 | - '<div style="text-align: right" class="pull-right invisible"><a href="%s" class="btn-edit-relation" data-field-label="%s">%s</a></div>', |
|
| 57 | - $this->getModuleLoader()->getModuleUrl($urlParameters), |
|
| 58 | - $fieldLabel, |
|
| 59 | - $this->getIconFactory()->getIcon('actions-add', Icon::SIZE_SMALL) |
|
| 60 | - ); |
|
| 61 | - } |
|
| 55 | + return sprintf( |
|
| 56 | + '<div style="text-align: right" class="pull-right invisible"><a href="%s" class="btn-edit-relation" data-field-label="%s">%s</a></div>', |
|
| 57 | + $this->getModuleLoader()->getModuleUrl($urlParameters), |
|
| 58 | + $fieldLabel, |
|
| 59 | + $this->getIconFactory()->getIcon('actions-add', Icon::SIZE_SMALL) |
|
| 60 | + ); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - protected function isBackendMode(): bool |
|
| 64 | - { |
|
| 65 | - return Typo3Mode::isBackendMode(); |
|
| 66 | - } |
|
| 63 | + protected function isBackendMode(): bool |
|
| 64 | + { |
|
| 65 | + return Typo3Mode::isBackendMode(); |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -22,42 +22,42 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class AdditionalAssetsViewHelper extends AbstractBackendViewHelper |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * Load the assets (JavaScript, CSS) for this Vidi module. |
|
| 27 | - * |
|
| 28 | - * @return void |
|
| 29 | - * @api |
|
| 30 | - */ |
|
| 31 | - public function render() |
|
| 32 | - { |
|
| 33 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 34 | - /** @var ModuleLoader $moduleLoader */ |
|
| 35 | - $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 25 | + /** |
|
| 26 | + * Load the assets (JavaScript, CSS) for this Vidi module. |
|
| 27 | + * |
|
| 28 | + * @return void |
|
| 29 | + * @api |
|
| 30 | + */ |
|
| 31 | + public function render() |
|
| 32 | + { |
|
| 33 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 34 | + /** @var ModuleLoader $moduleLoader */ |
|
| 35 | + $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 36 | 36 | |
| 37 | - foreach ($moduleLoader->getAdditionalStyleSheetFiles() as $addCssFile) { |
|
| 38 | - $fileNameAndPath = $this->resolvePath($addCssFile); |
|
| 39 | - $pageRenderer->addCssFile($fileNameAndPath); |
|
| 40 | - } |
|
| 37 | + foreach ($moduleLoader->getAdditionalStyleSheetFiles() as $addCssFile) { |
|
| 38 | + $fileNameAndPath = $this->resolvePath($addCssFile); |
|
| 39 | + $pageRenderer->addCssFile($fileNameAndPath); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - foreach ($moduleLoader->getAdditionalJavaScriptFiles() as $addJsFile) { |
|
| 43 | - $fileNameAndPath = $this->resolvePath($addJsFile); |
|
| 44 | - $pageRenderer->addJsFile($fileNameAndPath); |
|
| 45 | - } |
|
| 46 | - } |
|
| 42 | + foreach ($moduleLoader->getAdditionalJavaScriptFiles() as $addJsFile) { |
|
| 43 | + $fileNameAndPath = $this->resolvePath($addJsFile); |
|
| 44 | + $pageRenderer->addJsFile($fileNameAndPath); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Resolve a resource path. |
|
| 50 | - * |
|
| 51 | - * @param string $uri |
|
| 52 | - * @return string |
|
| 53 | - */ |
|
| 54 | - protected function resolvePath($uri) |
|
| 55 | - { |
|
| 56 | - $uri = GeneralUtility::getFileAbsFileName($uri); |
|
| 57 | - $uri = substr($uri, strlen(Environment::getPublicPath() . '/')); |
|
| 58 | - if (Typo3Mode::isBackendMode() && $uri !== false) { |
|
| 59 | - $uri = '../' . $uri; |
|
| 60 | - } |
|
| 61 | - return $uri; |
|
| 62 | - } |
|
| 48 | + /** |
|
| 49 | + * Resolve a resource path. |
|
| 50 | + * |
|
| 51 | + * @param string $uri |
|
| 52 | + * @return string |
|
| 53 | + */ |
|
| 54 | + protected function resolvePath($uri) |
|
| 55 | + { |
|
| 56 | + $uri = GeneralUtility::getFileAbsFileName($uri); |
|
| 57 | + $uri = substr($uri, strlen(Environment::getPublicPath() . '/')); |
|
| 58 | + if (Typo3Mode::isBackendMode() && $uri !== false) { |
|
| 59 | + $uri = '../' . $uri; |
|
| 60 | + } |
|
| 61 | + return $uri; |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -25,132 +25,132 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class Tca implements SingletonInterface, TcaServiceInterface |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * Fields that are considered as system. |
|
| 30 | - * |
|
| 31 | - * @var array |
|
| 32 | - */ |
|
| 33 | - protected static $systemFields = array( |
|
| 34 | - 'uid', |
|
| 35 | - 'pid', |
|
| 36 | - 'tstamp', |
|
| 37 | - 'crdate', |
|
| 38 | - 'deleted', |
|
| 39 | - 'hidden', |
|
| 40 | - 'sys_language_uid', |
|
| 41 | - 'l18n_parent', |
|
| 42 | - 'l18n_diffsource', |
|
| 43 | - 't3ver_oid', |
|
| 44 | - 't3ver_id', |
|
| 45 | - 't3ver_wsid', |
|
| 46 | - 't3ver_label', |
|
| 47 | - 't3ver_state', |
|
| 48 | - 't3ver_stage', |
|
| 49 | - 't3ver_count', |
|
| 50 | - 't3ver_tstamp', |
|
| 51 | - 't3_origuid', |
|
| 52 | - ); |
|
| 28 | + /** |
|
| 29 | + * Fields that are considered as system. |
|
| 30 | + * |
|
| 31 | + * @var array |
|
| 32 | + */ |
|
| 33 | + protected static $systemFields = array( |
|
| 34 | + 'uid', |
|
| 35 | + 'pid', |
|
| 36 | + 'tstamp', |
|
| 37 | + 'crdate', |
|
| 38 | + 'deleted', |
|
| 39 | + 'hidden', |
|
| 40 | + 'sys_language_uid', |
|
| 41 | + 'l18n_parent', |
|
| 42 | + 'l18n_diffsource', |
|
| 43 | + 't3ver_oid', |
|
| 44 | + 't3ver_id', |
|
| 45 | + 't3ver_wsid', |
|
| 46 | + 't3ver_label', |
|
| 47 | + 't3ver_state', |
|
| 48 | + 't3ver_stage', |
|
| 49 | + 't3ver_count', |
|
| 50 | + 't3ver_tstamp', |
|
| 51 | + 't3_origuid', |
|
| 52 | + ); |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @var array |
|
| 56 | - */ |
|
| 57 | - protected static $instances; |
|
| 54 | + /** |
|
| 55 | + * @var array |
|
| 56 | + */ |
|
| 57 | + protected static $instances; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Returns a class instance of a corresponding TCA service. |
|
| 61 | - * If the class instance does not exist, create one. |
|
| 62 | - * |
|
| 63 | - * @throws NotExistingClassException |
|
| 64 | - * @param string $dataType |
|
| 65 | - * @param string $serviceType |
|
| 66 | - * @return TcaServiceInterface |
|
| 67 | - * @throws InvalidKeyInArrayException |
|
| 68 | - * @throws \InvalidArgumentException |
|
| 69 | - */ |
|
| 70 | - protected static function getService($dataType, $serviceType) |
|
| 71 | - { |
|
| 72 | - if (Typo3Mode::isBackendMode() && empty($dataType)) { |
|
| 73 | - /** @var ModuleLoader $moduleLoader */ |
|
| 74 | - $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 75 | - $dataType = $moduleLoader->getDataType(); |
|
| 76 | - } |
|
| 59 | + /** |
|
| 60 | + * Returns a class instance of a corresponding TCA service. |
|
| 61 | + * If the class instance does not exist, create one. |
|
| 62 | + * |
|
| 63 | + * @throws NotExistingClassException |
|
| 64 | + * @param string $dataType |
|
| 65 | + * @param string $serviceType |
|
| 66 | + * @return TcaServiceInterface |
|
| 67 | + * @throws InvalidKeyInArrayException |
|
| 68 | + * @throws \InvalidArgumentException |
|
| 69 | + */ |
|
| 70 | + protected static function getService($dataType, $serviceType) |
|
| 71 | + { |
|
| 72 | + if (Typo3Mode::isBackendMode() && empty($dataType)) { |
|
| 73 | + /** @var ModuleLoader $moduleLoader */ |
|
| 74 | + $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 75 | + $dataType = $moduleLoader->getDataType(); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - if (empty(self::$instances[$dataType][$serviceType])) { |
|
| 79 | - $className = sprintf('Fab\Vidi\Tca\%sService', ucfirst($serviceType)); |
|
| 78 | + if (empty(self::$instances[$dataType][$serviceType])) { |
|
| 79 | + $className = sprintf('Fab\Vidi\Tca\%sService', ucfirst($serviceType)); |
|
| 80 | 80 | |
| 81 | - // Signal to pre-process the TCA of the given $dataType. |
|
| 82 | - self::emitPreProcessTcaSignal($dataType, $serviceType); |
|
| 81 | + // Signal to pre-process the TCA of the given $dataType. |
|
| 82 | + self::emitPreProcessTcaSignal($dataType, $serviceType); |
|
| 83 | 83 | |
| 84 | - $instance = GeneralUtility::makeInstance($className, $dataType, $serviceType); |
|
| 85 | - self::$instances[$dataType][$serviceType] = $instance; |
|
| 86 | - } |
|
| 87 | - return self::$instances[$dataType][$serviceType]; |
|
| 88 | - } |
|
| 84 | + $instance = GeneralUtility::makeInstance($className, $dataType, $serviceType); |
|
| 85 | + self::$instances[$dataType][$serviceType] = $instance; |
|
| 86 | + } |
|
| 87 | + return self::$instances[$dataType][$serviceType]; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Returns a "grid" service instance. |
|
| 92 | - * |
|
| 93 | - * @param string|Content $tableNameOrContentObject |
|
| 94 | - * @return GridService |
|
| 95 | - * @throws NotExistingClassException |
|
| 96 | - */ |
|
| 97 | - public static function grid($tableNameOrContentObject = '') |
|
| 98 | - { |
|
| 99 | - $tableName = $tableNameOrContentObject instanceof Content ? $tableNameOrContentObject->getDataType() : $tableNameOrContentObject; |
|
| 100 | - return self::getService($tableName, self::TYPE_GRID); |
|
| 101 | - } |
|
| 90 | + /** |
|
| 91 | + * Returns a "grid" service instance. |
|
| 92 | + * |
|
| 93 | + * @param string|Content $tableNameOrContentObject |
|
| 94 | + * @return GridService |
|
| 95 | + * @throws NotExistingClassException |
|
| 96 | + */ |
|
| 97 | + public static function grid($tableNameOrContentObject = '') |
|
| 98 | + { |
|
| 99 | + $tableName = $tableNameOrContentObject instanceof Content ? $tableNameOrContentObject->getDataType() : $tableNameOrContentObject; |
|
| 100 | + return self::getService($tableName, self::TYPE_GRID); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * Returns a "table" service instance ("ctrl" part of the TCA). |
|
| 105 | - * |
|
| 106 | - * @param string|Content $tableNameOrContentObject |
|
| 107 | - * @return TableService |
|
| 108 | - * @throws NotExistingClassException |
|
| 109 | - */ |
|
| 110 | - public static function table($tableNameOrContentObject = '') |
|
| 111 | - { |
|
| 112 | - $tableName = $tableNameOrContentObject instanceof Content ? $tableNameOrContentObject->getDataType() : $tableNameOrContentObject; |
|
| 113 | - return self::getService($tableName, self::TYPE_TABLE); |
|
| 114 | - } |
|
| 103 | + /** |
|
| 104 | + * Returns a "table" service instance ("ctrl" part of the TCA). |
|
| 105 | + * |
|
| 106 | + * @param string|Content $tableNameOrContentObject |
|
| 107 | + * @return TableService |
|
| 108 | + * @throws NotExistingClassException |
|
| 109 | + */ |
|
| 110 | + public static function table($tableNameOrContentObject = '') |
|
| 111 | + { |
|
| 112 | + $tableName = $tableNameOrContentObject instanceof Content ? $tableNameOrContentObject->getDataType() : $tableNameOrContentObject; |
|
| 113 | + return self::getService($tableName, self::TYPE_TABLE); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * @return array |
|
| 118 | - */ |
|
| 119 | - public static function getInstanceStorage() |
|
| 120 | - { |
|
| 121 | - return self::$instances; |
|
| 122 | - } |
|
| 116 | + /** |
|
| 117 | + * @return array |
|
| 118 | + */ |
|
| 119 | + public static function getInstanceStorage() |
|
| 120 | + { |
|
| 121 | + return self::$instances; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * @return array |
|
| 126 | - */ |
|
| 127 | - public static function getSystemFields() |
|
| 128 | - { |
|
| 129 | - return self::$systemFields; |
|
| 130 | - } |
|
| 124 | + /** |
|
| 125 | + * @return array |
|
| 126 | + */ |
|
| 127 | + public static function getSystemFields() |
|
| 128 | + { |
|
| 129 | + return self::$systemFields; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Signal that is called after the content repository for a content type has been instantiated. |
|
| 134 | - * |
|
| 135 | - * @param string $dataType |
|
| 136 | - * @param string $serviceType |
|
| 137 | - * @throws InvalidSlotException |
|
| 138 | - * @throws InvalidSlotReturnException |
|
| 139 | - * @throws \InvalidArgumentException |
|
| 140 | - */ |
|
| 141 | - protected static function emitPreProcessTcaSignal($dataType, $serviceType) |
|
| 142 | - { |
|
| 143 | - self::getSignalSlotDispatcher()->dispatch(Tca::class, 'preProcessTca', array($dataType, $serviceType)); |
|
| 144 | - } |
|
| 132 | + /** |
|
| 133 | + * Signal that is called after the content repository for a content type has been instantiated. |
|
| 134 | + * |
|
| 135 | + * @param string $dataType |
|
| 136 | + * @param string $serviceType |
|
| 137 | + * @throws InvalidSlotException |
|
| 138 | + * @throws InvalidSlotReturnException |
|
| 139 | + * @throws \InvalidArgumentException |
|
| 140 | + */ |
|
| 141 | + protected static function emitPreProcessTcaSignal($dataType, $serviceType) |
|
| 142 | + { |
|
| 143 | + self::getSignalSlotDispatcher()->dispatch(Tca::class, 'preProcessTca', array($dataType, $serviceType)); |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Get the SignalSlot dispatcher |
|
| 148 | - * |
|
| 149 | - * @return Dispatcher |
|
| 150 | - * @throws \InvalidArgumentException |
|
| 151 | - */ |
|
| 152 | - protected static function getSignalSlotDispatcher() |
|
| 153 | - { |
|
| 154 | - return GeneralUtility::makeInstance(Dispatcher::class); |
|
| 155 | - } |
|
| 146 | + /** |
|
| 147 | + * Get the SignalSlot dispatcher |
|
| 148 | + * |
|
| 149 | + * @return Dispatcher |
|
| 150 | + * @throws \InvalidArgumentException |
|
| 151 | + */ |
|
| 152 | + protected static function getSignalSlotDispatcher() |
|
| 153 | + { |
|
| 154 | + return GeneralUtility::makeInstance(Dispatcher::class); |
|
| 155 | + } |
|
| 156 | 156 | } |
@@ -19,23 +19,23 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | abstract class AbstractTca implements TcaServiceInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * Returns an instance of the current Backend User. |
|
| 24 | - * |
|
| 25 | - * @return BackendUserAuthentication |
|
| 26 | - */ |
|
| 27 | - protected function getBackendUser() |
|
| 28 | - { |
|
| 29 | - return $GLOBALS['BE_USER']; |
|
| 30 | - } |
|
| 22 | + /** |
|
| 23 | + * Returns an instance of the current Backend User. |
|
| 24 | + * |
|
| 25 | + * @return BackendUserAuthentication |
|
| 26 | + */ |
|
| 27 | + protected function getBackendUser() |
|
| 28 | + { |
|
| 29 | + return $GLOBALS['BE_USER']; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - protected function isBackendMode(): bool |
|
| 33 | - { |
|
| 34 | - return Typo3Mode::isBackendMode(); |
|
| 35 | - } |
|
| 32 | + protected function isBackendMode(): bool |
|
| 33 | + { |
|
| 34 | + return Typo3Mode::isBackendMode(); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - protected function isFrontendMode(): bool |
|
| 38 | - { |
|
| 39 | - return Typo3Mode::isFrontendMode(); |
|
| 40 | - } |
|
| 37 | + protected function isFrontendMode(): bool |
|
| 38 | + { |
|
| 39 | + return Typo3Mode::isFrontendMode(); |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -26,610 +26,610 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class Row extends AbstractComponentView |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @var array |
|
| 31 | - */ |
|
| 32 | - protected $columns = []; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Registry for storing variable values and speed up the processing. |
|
| 36 | - * |
|
| 37 | - * @var array |
|
| 38 | - */ |
|
| 39 | - protected $variables = []; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * @param array $columns |
|
| 43 | - */ |
|
| 44 | - public function __construct(array $columns = []) |
|
| 45 | - { |
|
| 46 | - $this->columns = $columns; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * Render a row to be displayed in the Grid given an Content Object. |
|
| 51 | - * |
|
| 52 | - * @param Content $object |
|
| 53 | - * @param int $rowIndex |
|
| 54 | - * @return array |
|
| 55 | - * @throws \Exception |
|
| 56 | - */ |
|
| 57 | - public function render(Content $object = null, $rowIndex = 0) |
|
| 58 | - { |
|
| 59 | - // Initialize returned array |
|
| 60 | - $output = []; |
|
| 61 | - |
|
| 62 | - foreach (Tca::grid()->getFields() as $fieldNameAndPath => $configuration) { |
|
| 63 | - $value = ''; // default is empty at first. |
|
| 64 | - |
|
| 65 | - $this->computeVariables($object, $fieldNameAndPath); |
|
| 66 | - |
|
| 67 | - // Only compute the value if it is going to be shown in the Grid. Lost of time otherwise! |
|
| 68 | - if (in_array($fieldNameAndPath, $this->columns)) { |
|
| 69 | - // Fetch value |
|
| 70 | - if (Tca::grid()->hasRenderers($fieldNameAndPath)) { |
|
| 71 | - $value = ''; |
|
| 72 | - $renderers = Tca::grid()->getRenderers($fieldNameAndPath); |
|
| 73 | - |
|
| 74 | - // if is relation has one |
|
| 75 | - foreach ($renderers as $rendererClassName => $rendererConfiguration) { |
|
| 76 | - /** @var $rendererObject \Fab\Vidi\Grid\ColumnRendererInterface */ |
|
| 77 | - $rendererObject = GeneralUtility::makeInstance($rendererClassName); |
|
| 78 | - $value .= $rendererObject |
|
| 79 | - ->setObject($object) |
|
| 80 | - ->setFieldName($fieldNameAndPath) |
|
| 81 | - ->setRowIndex($rowIndex) |
|
| 82 | - ->setFieldConfiguration($configuration) |
|
| 83 | - ->setGridRendererConfiguration($rendererConfiguration) |
|
| 84 | - ->render(); |
|
| 85 | - } |
|
| 86 | - } else { |
|
| 87 | - $value = $this->resolveValue($object, $fieldNameAndPath); |
|
| 88 | - $value = $this->processValue($value, $object, $fieldNameAndPath); // post resolve processing. |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - // Possible formatting given by configuration. @see TCA['grid'] |
|
| 92 | - $value = $this->formatValue($value, $configuration); |
|
| 93 | - |
|
| 94 | - // Here, there is the chance to further "decorate" the value for inline editing, localization, ... |
|
| 95 | - if ($this->willBeEnriched()) { |
|
| 96 | - $localizedStructure = $this->initializeLocalizedStructure($value); |
|
| 97 | - |
|
| 98 | - if ($this->isEditable()) { |
|
| 99 | - $localizedStructure = $this->addEditableMarkup($localizedStructure); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - if ($this->isLocalized()) { |
|
| 103 | - $localizedStructure = $this->addLocalizationMarkup($localizedStructure); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - if ($this->hasIcon()) { |
|
| 107 | - $localizedStructure = $this->addSpriteIconMarkup($localizedStructure); |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - $value = $this->flattenStructure($localizedStructure); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - // Final wrap given by configuration. @see TCA['grid'] |
|
| 114 | - $value = $this->wrapValue($value, $configuration); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - $output[$this->getFieldName()] = $value; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - $output['DT_RowId'] = 'row-' . $object->getUid(); |
|
| 121 | - $output['DT_RowClass'] = sprintf('%s_%s', $object->getDataType(), $object->getUid()); |
|
| 122 | - |
|
| 123 | - return $output; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Flatten the localized structure to render the final value |
|
| 128 | - * |
|
| 129 | - * @param array $localizedStructure |
|
| 130 | - * @return string |
|
| 131 | - */ |
|
| 132 | - protected function flattenStructure(array $localizedStructure) |
|
| 133 | - { |
|
| 134 | - // Flatten the structure. |
|
| 135 | - $value = ''; |
|
| 136 | - foreach ($localizedStructure as $structure) { |
|
| 137 | - $value .= sprintf( |
|
| 138 | - '<div class="%s">%s</div>', |
|
| 139 | - $structure['status'] !== LocalizationStatus::LOCALIZED ? 'invisible' : '', |
|
| 140 | - $structure['value'] |
|
| 141 | - ); |
|
| 142 | - } |
|
| 143 | - return $value; |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Store some often used variable values and speed up the processing. |
|
| 148 | - * |
|
| 149 | - * @param Content $object |
|
| 150 | - * @param string $fieldNameAndPath |
|
| 151 | - * @return void |
|
| 152 | - */ |
|
| 153 | - protected function computeVariables(Content $object, $fieldNameAndPath) |
|
| 154 | - { |
|
| 155 | - $this->variables = []; |
|
| 156 | - $this->variables['dataType'] = $this->getFieldPathResolver()->getDataType($fieldNameAndPath); |
|
| 157 | - $this->variables['fieldName'] = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath); |
|
| 158 | - $this->variables['fieldNameAndPath'] = $fieldNameAndPath; |
|
| 159 | - $this->variables['object'] = $object; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Tell whether the object will be decorated / wrapped such as |
|
| 164 | - * |
|
| 165 | - * @param string $value |
|
| 166 | - * @return array |
|
| 167 | - */ |
|
| 168 | - protected function initializeLocalizedStructure($value) |
|
| 169 | - { |
|
| 170 | - $localizedStructure[] = [ |
|
| 171 | - 'value' => empty($value) && $this->isEditable() ? $this->getEmptyValuePlaceholder() : $value, |
|
| 172 | - 'status' => empty($value) ? LocalizationStatus::EMPTY_VALUE : LocalizationStatus::LOCALIZED, |
|
| 173 | - 'language' => 0, |
|
| 174 | - 'languageFlag' => $defaultLanguage = $this->getLanguageService()->getDefaultFlag(), |
|
| 175 | - ]; |
|
| 176 | - |
|
| 177 | - if ($this->isLocalized()) { |
|
| 178 | - foreach ($this->getLanguageService()->getLanguages() as $language) { |
|
| 179 | - // Make sure the language is allowed for the current Backend User. |
|
| 180 | - if ($this->isLanguageAllowedForBackendUser($language)) { |
|
| 181 | - $resolvedObject = $this->getResolvedObject(); |
|
| 182 | - $fieldName = $this->getFieldName(); |
|
| 183 | - |
|
| 184 | - if ($this->getLanguageService()->hasLocalization($resolvedObject, $language['uid'])) { |
|
| 185 | - $localizedValue = $this->getLanguageService()->getLocalizedFieldName($resolvedObject, $language['uid'], $fieldName); |
|
| 186 | - $status = LocalizationStatus::LOCALIZED; |
|
| 187 | - |
|
| 188 | - // Replace blank value by something more meaningful for the End User. |
|
| 189 | - if (empty($localizedValue)) { |
|
| 190 | - $status = LocalizationStatus::EMPTY_VALUE; |
|
| 191 | - $localizedValue = $this->isEditable() ? $this->getEmptyValuePlaceholder() : ''; |
|
| 192 | - } |
|
| 193 | - } else { |
|
| 194 | - $localizedValue = sprintf( |
|
| 195 | - '<a href="%s" style="color: black">%s</a>', |
|
| 196 | - $this->getLocalizedUri($language['uid']), |
|
| 197 | - $this->getLabelService()->sL('LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:create_translation') |
|
| 198 | - ); |
|
| 199 | - $status = LocalizationStatus::NOT_YET_LOCALIZED; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - // Feed structure. |
|
| 203 | - $localizedStructure[] = [ |
|
| 204 | - 'value' => $localizedValue, |
|
| 205 | - 'status' => $status, |
|
| 206 | - 'language' => (int)$language['uid'], |
|
| 207 | - 'languageFlag' => $language['flag'], |
|
| 208 | - ]; |
|
| 209 | - } |
|
| 210 | - } |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - return $localizedStructure; |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * @param array $language |
|
| 218 | - * @return bool |
|
| 219 | - */ |
|
| 220 | - protected function isLanguageAllowedForBackendUser(array $language) |
|
| 221 | - { |
|
| 222 | - return $this->getBackendUser()->checkLanguageAccess($language['uid']); |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - /** |
|
| 226 | - * Returns a placeholder when the value is empty. |
|
| 227 | - */ |
|
| 228 | - protected function getEmptyValuePlaceholder(): string |
|
| 229 | - { |
|
| 230 | - // Deprecated code |
|
| 231 | - #return sprintf( |
|
| 232 | - # '<i>%s</i>', |
|
| 233 | - # $this->getLabelService()->sL('LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:start_editing') |
|
| 234 | - #); |
|
| 235 | - return ''; |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * Tell whether the object will be decorated (or wrapped) for inline editing, localization purpose. |
|
| 240 | - * |
|
| 241 | - * @return bool |
|
| 242 | - */ |
|
| 243 | - protected function willBeEnriched() |
|
| 244 | - { |
|
| 245 | - $willBeEnriched = false; |
|
| 246 | - |
|
| 247 | - if ($this->fieldExists()) { |
|
| 248 | - $willBeEnriched = $this->isEditable() || $this->hasIcon() || $this->isLocalized(); |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - return $willBeEnriched; |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Tell whether the field in the context will be prepended by an icon. |
|
| 256 | - * |
|
| 257 | - * @return bool |
|
| 258 | - */ |
|
| 259 | - protected function hasIcon() |
|
| 260 | - { |
|
| 261 | - $dataType = $this->getDataType(); |
|
| 262 | - return Tca::table($dataType)->getLabelField() === $this->getFieldName(); |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * Tell whether the field in the context will be prepended by an icon. |
|
| 267 | - * |
|
| 268 | - * @return bool |
|
| 269 | - */ |
|
| 270 | - protected function isLocalized() |
|
| 271 | - { |
|
| 272 | - $object = $this->getObject(); |
|
| 273 | - $fieldName = $this->getFieldName(); |
|
| 274 | - $dataType = $this->getDataType(); |
|
| 275 | - $fieldNameAndPath = $this->getFieldNameAndPath(); |
|
| 276 | - |
|
| 277 | - return $this->getLanguageService()->hasLanguages() |
|
| 278 | - && Tca::grid($object)->isLocalized($fieldNameAndPath) |
|
| 279 | - && Tca::table($dataType)->field($fieldName)->isLocalized(); |
|
| 280 | - } |
|
| 281 | - |
|
| 282 | - /** |
|
| 283 | - * Add some markup to have the content editable in the Grid. |
|
| 284 | - * |
|
| 285 | - * @param array $localizedStructure |
|
| 286 | - * @return array |
|
| 287 | - */ |
|
| 288 | - protected function addEditableMarkup(array $localizedStructure) |
|
| 289 | - { |
|
| 290 | - $dataType = $this->getDataType(); |
|
| 291 | - $fieldName = $this->getFieldName(); |
|
| 292 | - |
|
| 293 | - foreach ($localizedStructure as $index => $structure) { |
|
| 294 | - if ($structure['status'] !== LocalizationStatus::NOT_YET_LOCALIZED) { |
|
| 295 | - $localizedStructure[$index]['value'] = sprintf( |
|
| 296 | - '<span class="%s" data-language="%s">%s</span>', |
|
| 297 | - Tca::table($dataType)->field($fieldName)->isTextArea() ? 'editable-textarea' : 'editable-textfield', |
|
| 298 | - $structure['language'], |
|
| 299 | - $structure['value'] |
|
| 300 | - ); |
|
| 301 | - } |
|
| 302 | - } |
|
| 303 | - return $localizedStructure; |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - /** |
|
| 307 | - * Add some markup related to the localization. |
|
| 308 | - * |
|
| 309 | - * @param array $localizedStructure |
|
| 310 | - * @return array |
|
| 311 | - */ |
|
| 312 | - protected function addLocalizationMarkup(array $localizedStructure) |
|
| 313 | - { |
|
| 314 | - foreach ($localizedStructure as $index => $structure) { |
|
| 315 | - $localizedStructure[$index]['value'] = sprintf( |
|
| 316 | - '<span>%s %s</span>', |
|
| 317 | - empty($structure['languageFlag']) ? '' : $this->getIconFactory()->getIcon('flags-' . $structure['languageFlag'], Icon::SIZE_SMALL), |
|
| 318 | - $structure['value'] |
|
| 319 | - ); |
|
| 320 | - } |
|
| 321 | - return $localizedStructure; |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - /** |
|
| 325 | - * Add some markup related to the prepended icon. |
|
| 326 | - * |
|
| 327 | - * @param array $localizedStructure |
|
| 328 | - * @return array |
|
| 329 | - */ |
|
| 330 | - protected function addSpriteIconMarkup(array $localizedStructure) |
|
| 331 | - { |
|
| 332 | - $object = $this->getObject(); |
|
| 333 | - |
|
| 334 | - foreach ($localizedStructure as $index => $structure) { |
|
| 335 | - $recordData = []; |
|
| 336 | - |
|
| 337 | - $enablesMethods = array('Hidden', 'Deleted', 'StartTime', 'EndTime'); |
|
| 338 | - foreach ($enablesMethods as $enableMethod) { |
|
| 339 | - $methodName = 'get' . $enableMethod . 'Field'; |
|
| 340 | - |
|
| 341 | - // Fetch possible hidden filed. |
|
| 342 | - $enableField = Tca::table($object)->$methodName(); |
|
| 343 | - if ($enableField) { |
|
| 344 | - $recordData[$enableField] = $object[$enableField]; |
|
| 345 | - } |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - // Get Enable Fields of the object to render the sprite with overlays. |
|
| 349 | - $localizedStructure[$index]['value'] = sprintf( |
|
| 350 | - '%s %s', |
|
| 351 | - $this->getIconFactory()->getIconForRecord($object->getDataType(), $recordData, Icon::SIZE_SMALL), |
|
| 352 | - $structure['value'] |
|
| 353 | - ); |
|
| 354 | - } |
|
| 355 | - |
|
| 356 | - return $localizedStructure; |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * Return whether the field given by the context is editable. |
|
| 361 | - * |
|
| 362 | - * @return boolean |
|
| 363 | - */ |
|
| 364 | - protected function isEditable() |
|
| 365 | - { |
|
| 366 | - $fieldNameAndPath = $this->getFieldNameAndPath(); |
|
| 367 | - $dataType = $this->getDataType(); |
|
| 368 | - $fieldName = $this->getFieldName(); |
|
| 369 | - |
|
| 370 | - return Tca::grid()->isEditable($fieldNameAndPath) |
|
| 371 | - && Tca::table($dataType)->hasField($fieldName) |
|
| 372 | - && Tca::table($dataType)->field($fieldName)->hasNoRelation(); // relation are editable through Renderers only. |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * Return the appropriate URI to create the translation. |
|
| 377 | - * |
|
| 378 | - * @param int $language |
|
| 379 | - * @return string |
|
| 380 | - */ |
|
| 381 | - protected function getLocalizedUri($language) |
|
| 382 | - { |
|
| 383 | - // Transmit recursive selection parameter. |
|
| 384 | - $parameterPrefix = $this->getModuleLoader()->getParameterPrefix(); |
|
| 385 | - $parameters = GeneralUtility::_GP($parameterPrefix); |
|
| 386 | - |
|
| 387 | - $additionalParameters = array( |
|
| 388 | - $this->getModuleLoader()->getParameterPrefix() => array( |
|
| 389 | - 'controller' => 'Content', |
|
| 390 | - 'action' => 'localize', |
|
| 391 | - 'format' => 'json', |
|
| 392 | - 'hasRecursiveSelection' => isset($parameters['hasRecursiveSelection']) ? (int)$parameters['hasRecursiveSelection'] : 0, |
|
| 393 | - 'fieldNameAndPath' => $this->getFieldNameAndPath(), |
|
| 394 | - 'language' => $language, |
|
| 395 | - 'matches' => array( |
|
| 396 | - 'uid' => $this->getObject()->getUid(), |
|
| 397 | - ), |
|
| 398 | - ), |
|
| 399 | - ); |
|
| 400 | - |
|
| 401 | - return $this->getModuleLoader()->getModuleUrl($additionalParameters); |
|
| 402 | - } |
|
| 403 | - |
|
| 404 | - /** |
|
| 405 | - * Compute the value for the Content object according to a field name. |
|
| 406 | - * |
|
| 407 | - * @param Content $object |
|
| 408 | - * @param string $fieldNameAndPath |
|
| 409 | - * @return string |
|
| 410 | - */ |
|
| 411 | - protected function resolveValue(Content $object, $fieldNameAndPath) |
|
| 412 | - { |
|
| 413 | - // Get the first part of the field name and |
|
| 414 | - $fieldName = $this->getFieldPathResolver()->stripFieldName($fieldNameAndPath); |
|
| 415 | - |
|
| 416 | - $value = $object[$fieldName]; |
|
| 417 | - |
|
| 418 | - // Relation but contains no data. |
|
| 419 | - if (is_array($value) && empty($value)) { |
|
| 420 | - $value = ''; |
|
| 421 | - } elseif ($value instanceof Content) { |
|
| 422 | - $fieldNameOfForeignTable = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath); |
|
| 423 | - |
|
| 424 | - // true means the field name does not contains a path. "title" vs "metadata.title" |
|
| 425 | - // Fetch the default label |
|
| 426 | - if ($fieldNameOfForeignTable === $fieldName) { |
|
| 427 | - $foreignTable = Tca::table($object->getDataType())->field($fieldName)->getForeignTable(); |
|
| 428 | - $fieldNameOfForeignTable = Tca::table($foreignTable)->getLabelField(); |
|
| 429 | - } |
|
| 430 | - |
|
| 431 | - $value = $object[$fieldName][$fieldNameOfForeignTable]; |
|
| 432 | - } |
|
| 433 | - |
|
| 434 | - return $value; |
|
| 435 | - } |
|
| 436 | - |
|
| 437 | - /** |
|
| 438 | - * Check whether a string contains HTML tags. |
|
| 439 | - * |
|
| 440 | - * @param string $string the content to be analyzed |
|
| 441 | - * @return boolean |
|
| 442 | - */ |
|
| 443 | - protected function hasHtml($string) |
|
| 444 | - { |
|
| 445 | - $result = false; |
|
| 446 | - |
|
| 447 | - // We compare the length of the string with html tags and without html tags. |
|
| 448 | - if (strlen($string) !== strlen(strip_tags($string))) { |
|
| 449 | - $result = true; |
|
| 450 | - } |
|
| 451 | - return $result; |
|
| 452 | - } |
|
| 453 | - |
|
| 454 | - /** |
|
| 455 | - * Check whether a string contains potential XSS. |
|
| 456 | - * |
|
| 457 | - * @param string $string the content to be analyzed |
|
| 458 | - * @return boolean |
|
| 459 | - */ |
|
| 460 | - protected function isClean($string) |
|
| 461 | - { |
|
| 462 | - // @todo implement me! |
|
| 463 | - $result = true; |
|
| 464 | - return $result; |
|
| 465 | - } |
|
| 466 | - |
|
| 467 | - /** |
|
| 468 | - * Process the value |
|
| 469 | - * |
|
| 470 | - * @todo implement me as a processor chain to be cleaner implementation wise. Look out at the performance however! |
|
| 471 | - * e.g DefaultValueGridProcessor, TextAreaGridProcessor, ... |
|
| 472 | - * |
|
| 473 | - * @param string $value |
|
| 474 | - * @param Content $object |
|
| 475 | - * @param string $fieldNameAndPath |
|
| 476 | - * @return string |
|
| 477 | - * @throws InvalidKeyInArrayException |
|
| 478 | - */ |
|
| 479 | - protected function processValue($value, Content $object, $fieldNameAndPath) |
|
| 480 | - { |
|
| 481 | - // Set default value if $field name correspond to the label of the table |
|
| 482 | - $fieldName = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath); |
|
| 483 | - if (Tca::table($object->getDataType())->getLabelField() === $fieldName && empty($value)) { |
|
| 484 | - $value = sprintf('[%s]', $this->getLabelService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.no_title')); |
|
| 485 | - } |
|
| 486 | - |
|
| 487 | - // Sanitize the value in case of "select" or "radio button". |
|
| 488 | - if (is_scalar($value)) { |
|
| 489 | - $fieldType = Tca::table($object->getDataType())->field($fieldNameAndPath)->getType(); |
|
| 490 | - if ($fieldType !== FieldType::TEXTAREA) { |
|
| 491 | - $value = htmlspecialchars($value); |
|
| 492 | - } elseif ($fieldType === FieldType::TEXTAREA && !$this->isClean($value)) { |
|
| 493 | - $value = htmlspecialchars($value); // Avoid bad surprise, converts characters to HTML. |
|
| 494 | - } elseif ($fieldType === FieldType::TEXTAREA && !$this->hasHtml($value)) { |
|
| 495 | - $value = nl2br($value); |
|
| 496 | - } |
|
| 497 | - } |
|
| 498 | - |
|
| 499 | - return $value; |
|
| 500 | - } |
|
| 501 | - |
|
| 502 | - /** |
|
| 503 | - * Possible value formatting. |
|
| 504 | - * |
|
| 505 | - * @param string $value |
|
| 506 | - * @param array $configuration |
|
| 507 | - * @return string |
|
| 508 | - * @throws \InvalidArgumentException |
|
| 509 | - */ |
|
| 510 | - protected function formatValue($value, array $configuration) |
|
| 511 | - { |
|
| 512 | - if (empty($configuration['format'])) { |
|
| 513 | - return $value; |
|
| 514 | - } |
|
| 515 | - $className = $configuration['format']; |
|
| 516 | - |
|
| 517 | - /** @var FormatterInterface $formatter */ |
|
| 518 | - $formatter = GeneralUtility::makeInstance($className); |
|
| 519 | - $value = $formatter->format($value); |
|
| 520 | - |
|
| 521 | - return $value; |
|
| 522 | - } |
|
| 523 | - |
|
| 524 | - /** |
|
| 525 | - * Possible value wrapping. |
|
| 526 | - * |
|
| 527 | - * @param string $value |
|
| 528 | - * @param array $configuration |
|
| 529 | - * @return string |
|
| 530 | - */ |
|
| 531 | - protected function wrapValue($value, array $configuration) |
|
| 532 | - { |
|
| 533 | - if (!empty($configuration['wrap'])) { |
|
| 534 | - $parts = explode('|', $configuration['wrap']); |
|
| 535 | - $value = implode($value, $parts); |
|
| 536 | - } |
|
| 537 | - return $value; |
|
| 538 | - } |
|
| 539 | - |
|
| 540 | - /** |
|
| 541 | - * Tell whether the field in the context really exists. |
|
| 542 | - * |
|
| 543 | - * @return bool |
|
| 544 | - */ |
|
| 545 | - protected function fieldExists() |
|
| 546 | - { |
|
| 547 | - if ($this->variables['hasField'] === null) { |
|
| 548 | - $dataType = $this->getDataType(); |
|
| 549 | - $fieldName = $this->getFieldName(); |
|
| 550 | - $this->variables['hasField'] = Tca::table($dataType)->hasField($fieldName); |
|
| 551 | - } |
|
| 552 | - return $this->variables['hasField']; |
|
| 553 | - } |
|
| 554 | - |
|
| 555 | - /** |
|
| 556 | - * @return string |
|
| 557 | - */ |
|
| 558 | - protected function getDataType() |
|
| 559 | - { |
|
| 560 | - return $this->variables['dataType']; |
|
| 561 | - } |
|
| 562 | - |
|
| 563 | - /** |
|
| 564 | - * @return string |
|
| 565 | - */ |
|
| 566 | - protected function getFieldName() |
|
| 567 | - { |
|
| 568 | - return $this->variables['fieldName']; |
|
| 569 | - } |
|
| 570 | - |
|
| 571 | - /** |
|
| 572 | - * @return string |
|
| 573 | - */ |
|
| 574 | - protected function getFieldNameAndPath() |
|
| 575 | - { |
|
| 576 | - return $this->variables['fieldNameAndPath']; |
|
| 577 | - } |
|
| 578 | - |
|
| 579 | - /** |
|
| 580 | - * @return Content |
|
| 581 | - */ |
|
| 582 | - protected function getObject() |
|
| 583 | - { |
|
| 584 | - return $this->variables['object']; |
|
| 585 | - } |
|
| 586 | - |
|
| 587 | - /** |
|
| 588 | - * @return Content |
|
| 589 | - * @throws \InvalidArgumentException |
|
| 590 | - */ |
|
| 591 | - protected function getResolvedObject() |
|
| 592 | - { |
|
| 593 | - if (empty($this->variables['resolvedObject'])) { |
|
| 594 | - $object = $this->getObject(); |
|
| 595 | - $fieldNameAndPath = $this->getFieldNameAndPath(); |
|
| 596 | - $this->variables['resolvedObject'] = $this->getContentObjectResolver()->getObject($object, $fieldNameAndPath); |
|
| 597 | - } |
|
| 598 | - return $this->variables['resolvedObject']; |
|
| 599 | - } |
|
| 600 | - |
|
| 601 | - /** |
|
| 602 | - * @return FieldPathResolver|object |
|
| 603 | - * @throws \InvalidArgumentException |
|
| 604 | - */ |
|
| 605 | - protected function getFieldPathResolver() |
|
| 606 | - { |
|
| 607 | - return GeneralUtility::makeInstance(FieldPathResolver::class); |
|
| 608 | - } |
|
| 609 | - |
|
| 610 | - /** |
|
| 611 | - * @return ContentObjectResolver|object |
|
| 612 | - * @throws \InvalidArgumentException |
|
| 613 | - */ |
|
| 614 | - protected function getContentObjectResolver() |
|
| 615 | - { |
|
| 616 | - return GeneralUtility::makeInstance(ContentObjectResolver::class); |
|
| 617 | - } |
|
| 618 | - |
|
| 619 | - /** |
|
| 620 | - * @return \TYPO3\CMS\Core\Localization\LanguageService |
|
| 621 | - */ |
|
| 622 | - protected function getLabelService() |
|
| 623 | - { |
|
| 624 | - return $GLOBALS['LANG']; |
|
| 625 | - } |
|
| 626 | - |
|
| 627 | - /** |
|
| 628 | - * @return LanguageService|object |
|
| 629 | - * @throws \InvalidArgumentException |
|
| 630 | - */ |
|
| 631 | - protected function getLanguageService() |
|
| 632 | - { |
|
| 633 | - return GeneralUtility::makeInstance(LanguageService::class); |
|
| 634 | - } |
|
| 29 | + /** |
|
| 30 | + * @var array |
|
| 31 | + */ |
|
| 32 | + protected $columns = []; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Registry for storing variable values and speed up the processing. |
|
| 36 | + * |
|
| 37 | + * @var array |
|
| 38 | + */ |
|
| 39 | + protected $variables = []; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * @param array $columns |
|
| 43 | + */ |
|
| 44 | + public function __construct(array $columns = []) |
|
| 45 | + { |
|
| 46 | + $this->columns = $columns; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * Render a row to be displayed in the Grid given an Content Object. |
|
| 51 | + * |
|
| 52 | + * @param Content $object |
|
| 53 | + * @param int $rowIndex |
|
| 54 | + * @return array |
|
| 55 | + * @throws \Exception |
|
| 56 | + */ |
|
| 57 | + public function render(Content $object = null, $rowIndex = 0) |
|
| 58 | + { |
|
| 59 | + // Initialize returned array |
|
| 60 | + $output = []; |
|
| 61 | + |
|
| 62 | + foreach (Tca::grid()->getFields() as $fieldNameAndPath => $configuration) { |
|
| 63 | + $value = ''; // default is empty at first. |
|
| 64 | + |
|
| 65 | + $this->computeVariables($object, $fieldNameAndPath); |
|
| 66 | + |
|
| 67 | + // Only compute the value if it is going to be shown in the Grid. Lost of time otherwise! |
|
| 68 | + if (in_array($fieldNameAndPath, $this->columns)) { |
|
| 69 | + // Fetch value |
|
| 70 | + if (Tca::grid()->hasRenderers($fieldNameAndPath)) { |
|
| 71 | + $value = ''; |
|
| 72 | + $renderers = Tca::grid()->getRenderers($fieldNameAndPath); |
|
| 73 | + |
|
| 74 | + // if is relation has one |
|
| 75 | + foreach ($renderers as $rendererClassName => $rendererConfiguration) { |
|
| 76 | + /** @var $rendererObject \Fab\Vidi\Grid\ColumnRendererInterface */ |
|
| 77 | + $rendererObject = GeneralUtility::makeInstance($rendererClassName); |
|
| 78 | + $value .= $rendererObject |
|
| 79 | + ->setObject($object) |
|
| 80 | + ->setFieldName($fieldNameAndPath) |
|
| 81 | + ->setRowIndex($rowIndex) |
|
| 82 | + ->setFieldConfiguration($configuration) |
|
| 83 | + ->setGridRendererConfiguration($rendererConfiguration) |
|
| 84 | + ->render(); |
|
| 85 | + } |
|
| 86 | + } else { |
|
| 87 | + $value = $this->resolveValue($object, $fieldNameAndPath); |
|
| 88 | + $value = $this->processValue($value, $object, $fieldNameAndPath); // post resolve processing. |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + // Possible formatting given by configuration. @see TCA['grid'] |
|
| 92 | + $value = $this->formatValue($value, $configuration); |
|
| 93 | + |
|
| 94 | + // Here, there is the chance to further "decorate" the value for inline editing, localization, ... |
|
| 95 | + if ($this->willBeEnriched()) { |
|
| 96 | + $localizedStructure = $this->initializeLocalizedStructure($value); |
|
| 97 | + |
|
| 98 | + if ($this->isEditable()) { |
|
| 99 | + $localizedStructure = $this->addEditableMarkup($localizedStructure); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + if ($this->isLocalized()) { |
|
| 103 | + $localizedStructure = $this->addLocalizationMarkup($localizedStructure); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + if ($this->hasIcon()) { |
|
| 107 | + $localizedStructure = $this->addSpriteIconMarkup($localizedStructure); |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + $value = $this->flattenStructure($localizedStructure); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + // Final wrap given by configuration. @see TCA['grid'] |
|
| 114 | + $value = $this->wrapValue($value, $configuration); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + $output[$this->getFieldName()] = $value; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + $output['DT_RowId'] = 'row-' . $object->getUid(); |
|
| 121 | + $output['DT_RowClass'] = sprintf('%s_%s', $object->getDataType(), $object->getUid()); |
|
| 122 | + |
|
| 123 | + return $output; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Flatten the localized structure to render the final value |
|
| 128 | + * |
|
| 129 | + * @param array $localizedStructure |
|
| 130 | + * @return string |
|
| 131 | + */ |
|
| 132 | + protected function flattenStructure(array $localizedStructure) |
|
| 133 | + { |
|
| 134 | + // Flatten the structure. |
|
| 135 | + $value = ''; |
|
| 136 | + foreach ($localizedStructure as $structure) { |
|
| 137 | + $value .= sprintf( |
|
| 138 | + '<div class="%s">%s</div>', |
|
| 139 | + $structure['status'] !== LocalizationStatus::LOCALIZED ? 'invisible' : '', |
|
| 140 | + $structure['value'] |
|
| 141 | + ); |
|
| 142 | + } |
|
| 143 | + return $value; |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * Store some often used variable values and speed up the processing. |
|
| 148 | + * |
|
| 149 | + * @param Content $object |
|
| 150 | + * @param string $fieldNameAndPath |
|
| 151 | + * @return void |
|
| 152 | + */ |
|
| 153 | + protected function computeVariables(Content $object, $fieldNameAndPath) |
|
| 154 | + { |
|
| 155 | + $this->variables = []; |
|
| 156 | + $this->variables['dataType'] = $this->getFieldPathResolver()->getDataType($fieldNameAndPath); |
|
| 157 | + $this->variables['fieldName'] = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath); |
|
| 158 | + $this->variables['fieldNameAndPath'] = $fieldNameAndPath; |
|
| 159 | + $this->variables['object'] = $object; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Tell whether the object will be decorated / wrapped such as |
|
| 164 | + * |
|
| 165 | + * @param string $value |
|
| 166 | + * @return array |
|
| 167 | + */ |
|
| 168 | + protected function initializeLocalizedStructure($value) |
|
| 169 | + { |
|
| 170 | + $localizedStructure[] = [ |
|
| 171 | + 'value' => empty($value) && $this->isEditable() ? $this->getEmptyValuePlaceholder() : $value, |
|
| 172 | + 'status' => empty($value) ? LocalizationStatus::EMPTY_VALUE : LocalizationStatus::LOCALIZED, |
|
| 173 | + 'language' => 0, |
|
| 174 | + 'languageFlag' => $defaultLanguage = $this->getLanguageService()->getDefaultFlag(), |
|
| 175 | + ]; |
|
| 176 | + |
|
| 177 | + if ($this->isLocalized()) { |
|
| 178 | + foreach ($this->getLanguageService()->getLanguages() as $language) { |
|
| 179 | + // Make sure the language is allowed for the current Backend User. |
|
| 180 | + if ($this->isLanguageAllowedForBackendUser($language)) { |
|
| 181 | + $resolvedObject = $this->getResolvedObject(); |
|
| 182 | + $fieldName = $this->getFieldName(); |
|
| 183 | + |
|
| 184 | + if ($this->getLanguageService()->hasLocalization($resolvedObject, $language['uid'])) { |
|
| 185 | + $localizedValue = $this->getLanguageService()->getLocalizedFieldName($resolvedObject, $language['uid'], $fieldName); |
|
| 186 | + $status = LocalizationStatus::LOCALIZED; |
|
| 187 | + |
|
| 188 | + // Replace blank value by something more meaningful for the End User. |
|
| 189 | + if (empty($localizedValue)) { |
|
| 190 | + $status = LocalizationStatus::EMPTY_VALUE; |
|
| 191 | + $localizedValue = $this->isEditable() ? $this->getEmptyValuePlaceholder() : ''; |
|
| 192 | + } |
|
| 193 | + } else { |
|
| 194 | + $localizedValue = sprintf( |
|
| 195 | + '<a href="%s" style="color: black">%s</a>', |
|
| 196 | + $this->getLocalizedUri($language['uid']), |
|
| 197 | + $this->getLabelService()->sL('LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:create_translation') |
|
| 198 | + ); |
|
| 199 | + $status = LocalizationStatus::NOT_YET_LOCALIZED; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + // Feed structure. |
|
| 203 | + $localizedStructure[] = [ |
|
| 204 | + 'value' => $localizedValue, |
|
| 205 | + 'status' => $status, |
|
| 206 | + 'language' => (int)$language['uid'], |
|
| 207 | + 'languageFlag' => $language['flag'], |
|
| 208 | + ]; |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + return $localizedStructure; |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * @param array $language |
|
| 218 | + * @return bool |
|
| 219 | + */ |
|
| 220 | + protected function isLanguageAllowedForBackendUser(array $language) |
|
| 221 | + { |
|
| 222 | + return $this->getBackendUser()->checkLanguageAccess($language['uid']); |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + /** |
|
| 226 | + * Returns a placeholder when the value is empty. |
|
| 227 | + */ |
|
| 228 | + protected function getEmptyValuePlaceholder(): string |
|
| 229 | + { |
|
| 230 | + // Deprecated code |
|
| 231 | + #return sprintf( |
|
| 232 | + # '<i>%s</i>', |
|
| 233 | + # $this->getLabelService()->sL('LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:start_editing') |
|
| 234 | + #); |
|
| 235 | + return ''; |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * Tell whether the object will be decorated (or wrapped) for inline editing, localization purpose. |
|
| 240 | + * |
|
| 241 | + * @return bool |
|
| 242 | + */ |
|
| 243 | + protected function willBeEnriched() |
|
| 244 | + { |
|
| 245 | + $willBeEnriched = false; |
|
| 246 | + |
|
| 247 | + if ($this->fieldExists()) { |
|
| 248 | + $willBeEnriched = $this->isEditable() || $this->hasIcon() || $this->isLocalized(); |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + return $willBeEnriched; |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Tell whether the field in the context will be prepended by an icon. |
|
| 256 | + * |
|
| 257 | + * @return bool |
|
| 258 | + */ |
|
| 259 | + protected function hasIcon() |
|
| 260 | + { |
|
| 261 | + $dataType = $this->getDataType(); |
|
| 262 | + return Tca::table($dataType)->getLabelField() === $this->getFieldName(); |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * Tell whether the field in the context will be prepended by an icon. |
|
| 267 | + * |
|
| 268 | + * @return bool |
|
| 269 | + */ |
|
| 270 | + protected function isLocalized() |
|
| 271 | + { |
|
| 272 | + $object = $this->getObject(); |
|
| 273 | + $fieldName = $this->getFieldName(); |
|
| 274 | + $dataType = $this->getDataType(); |
|
| 275 | + $fieldNameAndPath = $this->getFieldNameAndPath(); |
|
| 276 | + |
|
| 277 | + return $this->getLanguageService()->hasLanguages() |
|
| 278 | + && Tca::grid($object)->isLocalized($fieldNameAndPath) |
|
| 279 | + && Tca::table($dataType)->field($fieldName)->isLocalized(); |
|
| 280 | + } |
|
| 281 | + |
|
| 282 | + /** |
|
| 283 | + * Add some markup to have the content editable in the Grid. |
|
| 284 | + * |
|
| 285 | + * @param array $localizedStructure |
|
| 286 | + * @return array |
|
| 287 | + */ |
|
| 288 | + protected function addEditableMarkup(array $localizedStructure) |
|
| 289 | + { |
|
| 290 | + $dataType = $this->getDataType(); |
|
| 291 | + $fieldName = $this->getFieldName(); |
|
| 292 | + |
|
| 293 | + foreach ($localizedStructure as $index => $structure) { |
|
| 294 | + if ($structure['status'] !== LocalizationStatus::NOT_YET_LOCALIZED) { |
|
| 295 | + $localizedStructure[$index]['value'] = sprintf( |
|
| 296 | + '<span class="%s" data-language="%s">%s</span>', |
|
| 297 | + Tca::table($dataType)->field($fieldName)->isTextArea() ? 'editable-textarea' : 'editable-textfield', |
|
| 298 | + $structure['language'], |
|
| 299 | + $structure['value'] |
|
| 300 | + ); |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | + return $localizedStructure; |
|
| 304 | + } |
|
| 305 | + |
|
| 306 | + /** |
|
| 307 | + * Add some markup related to the localization. |
|
| 308 | + * |
|
| 309 | + * @param array $localizedStructure |
|
| 310 | + * @return array |
|
| 311 | + */ |
|
| 312 | + protected function addLocalizationMarkup(array $localizedStructure) |
|
| 313 | + { |
|
| 314 | + foreach ($localizedStructure as $index => $structure) { |
|
| 315 | + $localizedStructure[$index]['value'] = sprintf( |
|
| 316 | + '<span>%s %s</span>', |
|
| 317 | + empty($structure['languageFlag']) ? '' : $this->getIconFactory()->getIcon('flags-' . $structure['languageFlag'], Icon::SIZE_SMALL), |
|
| 318 | + $structure['value'] |
|
| 319 | + ); |
|
| 320 | + } |
|
| 321 | + return $localizedStructure; |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + /** |
|
| 325 | + * Add some markup related to the prepended icon. |
|
| 326 | + * |
|
| 327 | + * @param array $localizedStructure |
|
| 328 | + * @return array |
|
| 329 | + */ |
|
| 330 | + protected function addSpriteIconMarkup(array $localizedStructure) |
|
| 331 | + { |
|
| 332 | + $object = $this->getObject(); |
|
| 333 | + |
|
| 334 | + foreach ($localizedStructure as $index => $structure) { |
|
| 335 | + $recordData = []; |
|
| 336 | + |
|
| 337 | + $enablesMethods = array('Hidden', 'Deleted', 'StartTime', 'EndTime'); |
|
| 338 | + foreach ($enablesMethods as $enableMethod) { |
|
| 339 | + $methodName = 'get' . $enableMethod . 'Field'; |
|
| 340 | + |
|
| 341 | + // Fetch possible hidden filed. |
|
| 342 | + $enableField = Tca::table($object)->$methodName(); |
|
| 343 | + if ($enableField) { |
|
| 344 | + $recordData[$enableField] = $object[$enableField]; |
|
| 345 | + } |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + // Get Enable Fields of the object to render the sprite with overlays. |
|
| 349 | + $localizedStructure[$index]['value'] = sprintf( |
|
| 350 | + '%s %s', |
|
| 351 | + $this->getIconFactory()->getIconForRecord($object->getDataType(), $recordData, Icon::SIZE_SMALL), |
|
| 352 | + $structure['value'] |
|
| 353 | + ); |
|
| 354 | + } |
|
| 355 | + |
|
| 356 | + return $localizedStructure; |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * Return whether the field given by the context is editable. |
|
| 361 | + * |
|
| 362 | + * @return boolean |
|
| 363 | + */ |
|
| 364 | + protected function isEditable() |
|
| 365 | + { |
|
| 366 | + $fieldNameAndPath = $this->getFieldNameAndPath(); |
|
| 367 | + $dataType = $this->getDataType(); |
|
| 368 | + $fieldName = $this->getFieldName(); |
|
| 369 | + |
|
| 370 | + return Tca::grid()->isEditable($fieldNameAndPath) |
|
| 371 | + && Tca::table($dataType)->hasField($fieldName) |
|
| 372 | + && Tca::table($dataType)->field($fieldName)->hasNoRelation(); // relation are editable through Renderers only. |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * Return the appropriate URI to create the translation. |
|
| 377 | + * |
|
| 378 | + * @param int $language |
|
| 379 | + * @return string |
|
| 380 | + */ |
|
| 381 | + protected function getLocalizedUri($language) |
|
| 382 | + { |
|
| 383 | + // Transmit recursive selection parameter. |
|
| 384 | + $parameterPrefix = $this->getModuleLoader()->getParameterPrefix(); |
|
| 385 | + $parameters = GeneralUtility::_GP($parameterPrefix); |
|
| 386 | + |
|
| 387 | + $additionalParameters = array( |
|
| 388 | + $this->getModuleLoader()->getParameterPrefix() => array( |
|
| 389 | + 'controller' => 'Content', |
|
| 390 | + 'action' => 'localize', |
|
| 391 | + 'format' => 'json', |
|
| 392 | + 'hasRecursiveSelection' => isset($parameters['hasRecursiveSelection']) ? (int)$parameters['hasRecursiveSelection'] : 0, |
|
| 393 | + 'fieldNameAndPath' => $this->getFieldNameAndPath(), |
|
| 394 | + 'language' => $language, |
|
| 395 | + 'matches' => array( |
|
| 396 | + 'uid' => $this->getObject()->getUid(), |
|
| 397 | + ), |
|
| 398 | + ), |
|
| 399 | + ); |
|
| 400 | + |
|
| 401 | + return $this->getModuleLoader()->getModuleUrl($additionalParameters); |
|
| 402 | + } |
|
| 403 | + |
|
| 404 | + /** |
|
| 405 | + * Compute the value for the Content object according to a field name. |
|
| 406 | + * |
|
| 407 | + * @param Content $object |
|
| 408 | + * @param string $fieldNameAndPath |
|
| 409 | + * @return string |
|
| 410 | + */ |
|
| 411 | + protected function resolveValue(Content $object, $fieldNameAndPath) |
|
| 412 | + { |
|
| 413 | + // Get the first part of the field name and |
|
| 414 | + $fieldName = $this->getFieldPathResolver()->stripFieldName($fieldNameAndPath); |
|
| 415 | + |
|
| 416 | + $value = $object[$fieldName]; |
|
| 417 | + |
|
| 418 | + // Relation but contains no data. |
|
| 419 | + if (is_array($value) && empty($value)) { |
|
| 420 | + $value = ''; |
|
| 421 | + } elseif ($value instanceof Content) { |
|
| 422 | + $fieldNameOfForeignTable = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath); |
|
| 423 | + |
|
| 424 | + // true means the field name does not contains a path. "title" vs "metadata.title" |
|
| 425 | + // Fetch the default label |
|
| 426 | + if ($fieldNameOfForeignTable === $fieldName) { |
|
| 427 | + $foreignTable = Tca::table($object->getDataType())->field($fieldName)->getForeignTable(); |
|
| 428 | + $fieldNameOfForeignTable = Tca::table($foreignTable)->getLabelField(); |
|
| 429 | + } |
|
| 430 | + |
|
| 431 | + $value = $object[$fieldName][$fieldNameOfForeignTable]; |
|
| 432 | + } |
|
| 433 | + |
|
| 434 | + return $value; |
|
| 435 | + } |
|
| 436 | + |
|
| 437 | + /** |
|
| 438 | + * Check whether a string contains HTML tags. |
|
| 439 | + * |
|
| 440 | + * @param string $string the content to be analyzed |
|
| 441 | + * @return boolean |
|
| 442 | + */ |
|
| 443 | + protected function hasHtml($string) |
|
| 444 | + { |
|
| 445 | + $result = false; |
|
| 446 | + |
|
| 447 | + // We compare the length of the string with html tags and without html tags. |
|
| 448 | + if (strlen($string) !== strlen(strip_tags($string))) { |
|
| 449 | + $result = true; |
|
| 450 | + } |
|
| 451 | + return $result; |
|
| 452 | + } |
|
| 453 | + |
|
| 454 | + /** |
|
| 455 | + * Check whether a string contains potential XSS. |
|
| 456 | + * |
|
| 457 | + * @param string $string the content to be analyzed |
|
| 458 | + * @return boolean |
|
| 459 | + */ |
|
| 460 | + protected function isClean($string) |
|
| 461 | + { |
|
| 462 | + // @todo implement me! |
|
| 463 | + $result = true; |
|
| 464 | + return $result; |
|
| 465 | + } |
|
| 466 | + |
|
| 467 | + /** |
|
| 468 | + * Process the value |
|
| 469 | + * |
|
| 470 | + * @todo implement me as a processor chain to be cleaner implementation wise. Look out at the performance however! |
|
| 471 | + * e.g DefaultValueGridProcessor, TextAreaGridProcessor, ... |
|
| 472 | + * |
|
| 473 | + * @param string $value |
|
| 474 | + * @param Content $object |
|
| 475 | + * @param string $fieldNameAndPath |
|
| 476 | + * @return string |
|
| 477 | + * @throws InvalidKeyInArrayException |
|
| 478 | + */ |
|
| 479 | + protected function processValue($value, Content $object, $fieldNameAndPath) |
|
| 480 | + { |
|
| 481 | + // Set default value if $field name correspond to the label of the table |
|
| 482 | + $fieldName = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath); |
|
| 483 | + if (Tca::table($object->getDataType())->getLabelField() === $fieldName && empty($value)) { |
|
| 484 | + $value = sprintf('[%s]', $this->getLabelService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.no_title')); |
|
| 485 | + } |
|
| 486 | + |
|
| 487 | + // Sanitize the value in case of "select" or "radio button". |
|
| 488 | + if (is_scalar($value)) { |
|
| 489 | + $fieldType = Tca::table($object->getDataType())->field($fieldNameAndPath)->getType(); |
|
| 490 | + if ($fieldType !== FieldType::TEXTAREA) { |
|
| 491 | + $value = htmlspecialchars($value); |
|
| 492 | + } elseif ($fieldType === FieldType::TEXTAREA && !$this->isClean($value)) { |
|
| 493 | + $value = htmlspecialchars($value); // Avoid bad surprise, converts characters to HTML. |
|
| 494 | + } elseif ($fieldType === FieldType::TEXTAREA && !$this->hasHtml($value)) { |
|
| 495 | + $value = nl2br($value); |
|
| 496 | + } |
|
| 497 | + } |
|
| 498 | + |
|
| 499 | + return $value; |
|
| 500 | + } |
|
| 501 | + |
|
| 502 | + /** |
|
| 503 | + * Possible value formatting. |
|
| 504 | + * |
|
| 505 | + * @param string $value |
|
| 506 | + * @param array $configuration |
|
| 507 | + * @return string |
|
| 508 | + * @throws \InvalidArgumentException |
|
| 509 | + */ |
|
| 510 | + protected function formatValue($value, array $configuration) |
|
| 511 | + { |
|
| 512 | + if (empty($configuration['format'])) { |
|
| 513 | + return $value; |
|
| 514 | + } |
|
| 515 | + $className = $configuration['format']; |
|
| 516 | + |
|
| 517 | + /** @var FormatterInterface $formatter */ |
|
| 518 | + $formatter = GeneralUtility::makeInstance($className); |
|
| 519 | + $value = $formatter->format($value); |
|
| 520 | + |
|
| 521 | + return $value; |
|
| 522 | + } |
|
| 523 | + |
|
| 524 | + /** |
|
| 525 | + * Possible value wrapping. |
|
| 526 | + * |
|
| 527 | + * @param string $value |
|
| 528 | + * @param array $configuration |
|
| 529 | + * @return string |
|
| 530 | + */ |
|
| 531 | + protected function wrapValue($value, array $configuration) |
|
| 532 | + { |
|
| 533 | + if (!empty($configuration['wrap'])) { |
|
| 534 | + $parts = explode('|', $configuration['wrap']); |
|
| 535 | + $value = implode($value, $parts); |
|
| 536 | + } |
|
| 537 | + return $value; |
|
| 538 | + } |
|
| 539 | + |
|
| 540 | + /** |
|
| 541 | + * Tell whether the field in the context really exists. |
|
| 542 | + * |
|
| 543 | + * @return bool |
|
| 544 | + */ |
|
| 545 | + protected function fieldExists() |
|
| 546 | + { |
|
| 547 | + if ($this->variables['hasField'] === null) { |
|
| 548 | + $dataType = $this->getDataType(); |
|
| 549 | + $fieldName = $this->getFieldName(); |
|
| 550 | + $this->variables['hasField'] = Tca::table($dataType)->hasField($fieldName); |
|
| 551 | + } |
|
| 552 | + return $this->variables['hasField']; |
|
| 553 | + } |
|
| 554 | + |
|
| 555 | + /** |
|
| 556 | + * @return string |
|
| 557 | + */ |
|
| 558 | + protected function getDataType() |
|
| 559 | + { |
|
| 560 | + return $this->variables['dataType']; |
|
| 561 | + } |
|
| 562 | + |
|
| 563 | + /** |
|
| 564 | + * @return string |
|
| 565 | + */ |
|
| 566 | + protected function getFieldName() |
|
| 567 | + { |
|
| 568 | + return $this->variables['fieldName']; |
|
| 569 | + } |
|
| 570 | + |
|
| 571 | + /** |
|
| 572 | + * @return string |
|
| 573 | + */ |
|
| 574 | + protected function getFieldNameAndPath() |
|
| 575 | + { |
|
| 576 | + return $this->variables['fieldNameAndPath']; |
|
| 577 | + } |
|
| 578 | + |
|
| 579 | + /** |
|
| 580 | + * @return Content |
|
| 581 | + */ |
|
| 582 | + protected function getObject() |
|
| 583 | + { |
|
| 584 | + return $this->variables['object']; |
|
| 585 | + } |
|
| 586 | + |
|
| 587 | + /** |
|
| 588 | + * @return Content |
|
| 589 | + * @throws \InvalidArgumentException |
|
| 590 | + */ |
|
| 591 | + protected function getResolvedObject() |
|
| 592 | + { |
|
| 593 | + if (empty($this->variables['resolvedObject'])) { |
|
| 594 | + $object = $this->getObject(); |
|
| 595 | + $fieldNameAndPath = $this->getFieldNameAndPath(); |
|
| 596 | + $this->variables['resolvedObject'] = $this->getContentObjectResolver()->getObject($object, $fieldNameAndPath); |
|
| 597 | + } |
|
| 598 | + return $this->variables['resolvedObject']; |
|
| 599 | + } |
|
| 600 | + |
|
| 601 | + /** |
|
| 602 | + * @return FieldPathResolver|object |
|
| 603 | + * @throws \InvalidArgumentException |
|
| 604 | + */ |
|
| 605 | + protected function getFieldPathResolver() |
|
| 606 | + { |
|
| 607 | + return GeneralUtility::makeInstance(FieldPathResolver::class); |
|
| 608 | + } |
|
| 609 | + |
|
| 610 | + /** |
|
| 611 | + * @return ContentObjectResolver|object |
|
| 612 | + * @throws \InvalidArgumentException |
|
| 613 | + */ |
|
| 614 | + protected function getContentObjectResolver() |
|
| 615 | + { |
|
| 616 | + return GeneralUtility::makeInstance(ContentObjectResolver::class); |
|
| 617 | + } |
|
| 618 | + |
|
| 619 | + /** |
|
| 620 | + * @return \TYPO3\CMS\Core\Localization\LanguageService |
|
| 621 | + */ |
|
| 622 | + protected function getLabelService() |
|
| 623 | + { |
|
| 624 | + return $GLOBALS['LANG']; |
|
| 625 | + } |
|
| 626 | + |
|
| 627 | + /** |
|
| 628 | + * @return LanguageService|object |
|
| 629 | + * @throws \InvalidArgumentException |
|
| 630 | + */ |
|
| 631 | + protected function getLanguageService() |
|
| 632 | + { |
|
| 633 | + return GeneralUtility::makeInstance(LanguageService::class); |
|
| 634 | + } |
|
| 635 | 635 | } |
@@ -14,13 +14,13 @@ |
||
| 14 | 14 | |
| 15 | 15 | class Typo3Mode |
| 16 | 16 | { |
| 17 | - static public function isBackendMode(): bool |
|
| 18 | - { |
|
| 19 | - return ($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); |
|
| 20 | - } |
|
| 17 | + static public function isBackendMode(): bool |
|
| 18 | + { |
|
| 19 | + return ($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend(); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - static public function isFrontendMode(): bool |
|
| 23 | - { |
|
| 24 | - return ($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend(); |
|
| 25 | - } |
|
| 22 | + static public function isFrontendMode(): bool |
|
| 23 | + { |
|
| 24 | + return ($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend(); |
|
| 25 | + } |
|
| 26 | 26 | } |
@@ -7,113 +7,113 @@ |
||
| 7 | 7 | use TYPO3\CMS\Core\Utility\ArrayUtility; |
| 8 | 8 | |
| 9 | 9 | if (!defined('TYPO3')) { |
| 10 | - die('Access denied.'); |
|
| 10 | + die('Access denied.'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | $tca = [ |
| 14 | - 'ctrl' => [ |
|
| 15 | - // By default "searchFields" has many fields which has a performance cost when dealing with large data-set. |
|
| 16 | - // Override search field for performance reason. |
|
| 17 | - // To restore default values, just replace with this: $GLOBALS['TCA']['fe_users']['ctrl']['searchFields'] . ',usergroup', |
|
| 18 | - 'searchFields' => 'username, first_name, last_name, usergroup', |
|
| 19 | - ], |
|
| 20 | - 'vidi' => [ |
|
| 21 | - // Special case when the field name does not follow the conventions. |
|
| 22 | - // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
| 23 | - 'mappings' => [ |
|
| 24 | - 'lockToDomain' => 'lockToDomain', |
|
| 25 | - 'TSconfig' => 'tsConfig', |
|
| 26 | - 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
| 27 | - 'felogin_forgotHash' => 'feLoginForgotHash', |
|
| 28 | - ], |
|
| 29 | - ], |
|
| 30 | - 'grid' => [ |
|
| 31 | - 'excluded_fields' => 'lockToDomain, TSconfig, felogin_redirectPid, felogin_forgotHash, auth_token, image', |
|
| 32 | - 'export' => [ |
|
| 33 | - 'include_files' => false, |
|
| 34 | - ], |
|
| 35 | - 'facets' => [ |
|
| 36 | - 'uid', |
|
| 37 | - 'username', |
|
| 38 | - 'name', |
|
| 39 | - 'first_name', |
|
| 40 | - 'last_name', |
|
| 41 | - 'address', |
|
| 42 | - 'telephone', |
|
| 43 | - 'fax', |
|
| 44 | - 'email', |
|
| 45 | - 'title', |
|
| 46 | - 'zip', |
|
| 47 | - 'city', |
|
| 48 | - 'country', |
|
| 49 | - 'company', |
|
| 50 | - 'usergroup', |
|
| 51 | - StandardFacet::class => [ |
|
| 52 | - 'name' => 'disable', |
|
| 53 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
| 54 | - 'suggestions' => [ |
|
| 55 | - '0' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.0', |
|
| 56 | - '1' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.1' |
|
| 57 | - ] |
|
| 58 | - ], |
|
| 59 | - PageFacet::class => [ |
|
| 60 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
| 61 | - ], |
|
| 62 | - ], |
|
| 63 | - 'columns' => [ |
|
| 64 | - '__checkbox' => [ |
|
| 65 | - 'renderer' => CheckBoxRenderer::class, |
|
| 66 | - ], |
|
| 67 | - 'uid' => [ |
|
| 68 | - 'visible' => false, |
|
| 69 | - 'label' => 'Id', |
|
| 70 | - 'width' => '5px', |
|
| 71 | - ], |
|
| 72 | - 'username' => [ |
|
| 73 | - 'visible' => true, |
|
| 74 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:username', |
|
| 75 | - 'editable' => true, |
|
| 76 | - ], |
|
| 77 | - 'name' => [ |
|
| 78 | - 'visible' => true, |
|
| 79 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:name', |
|
| 80 | - 'editable' => true, |
|
| 81 | - ], |
|
| 82 | - 'email' => [ |
|
| 83 | - 'visible' => true, |
|
| 84 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:email', |
|
| 85 | - 'editable' => true, |
|
| 86 | - ], |
|
| 87 | - 'usergroup' => [ |
|
| 88 | - 'visible' => true, |
|
| 89 | - 'renderers' => [ |
|
| 90 | - 'Fab\Vidi\Grid\RelationEditRenderer', |
|
| 91 | - 'Fab\Vidi\Grid\RelationRenderer', |
|
| 92 | - ], |
|
| 93 | - 'editable' => true, |
|
| 94 | - 'sortable' => false, |
|
| 95 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:usergroup', |
|
| 96 | - ], |
|
| 97 | - 'tstamp' => [ |
|
| 98 | - 'visible' => false, |
|
| 99 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
| 100 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
| 101 | - ], |
|
| 102 | - 'crdate' => [ |
|
| 103 | - 'visible' => false, |
|
| 104 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
| 105 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
| 106 | - ], |
|
| 107 | - #'disable' => [ |
|
| 108 | - # 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
| 109 | - # 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
| 110 | - # 'width' => '3%', |
|
| 111 | - #], |
|
| 112 | - '__buttons' => [ |
|
| 113 | - 'renderer' => ButtonGroupRenderer::class, |
|
| 114 | - ], |
|
| 115 | - ], |
|
| 116 | - ], |
|
| 14 | + 'ctrl' => [ |
|
| 15 | + // By default "searchFields" has many fields which has a performance cost when dealing with large data-set. |
|
| 16 | + // Override search field for performance reason. |
|
| 17 | + // To restore default values, just replace with this: $GLOBALS['TCA']['fe_users']['ctrl']['searchFields'] . ',usergroup', |
|
| 18 | + 'searchFields' => 'username, first_name, last_name, usergroup', |
|
| 19 | + ], |
|
| 20 | + 'vidi' => [ |
|
| 21 | + // Special case when the field name does not follow the conventions. |
|
| 22 | + // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
| 23 | + 'mappings' => [ |
|
| 24 | + 'lockToDomain' => 'lockToDomain', |
|
| 25 | + 'TSconfig' => 'tsConfig', |
|
| 26 | + 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
| 27 | + 'felogin_forgotHash' => 'feLoginForgotHash', |
|
| 28 | + ], |
|
| 29 | + ], |
|
| 30 | + 'grid' => [ |
|
| 31 | + 'excluded_fields' => 'lockToDomain, TSconfig, felogin_redirectPid, felogin_forgotHash, auth_token, image', |
|
| 32 | + 'export' => [ |
|
| 33 | + 'include_files' => false, |
|
| 34 | + ], |
|
| 35 | + 'facets' => [ |
|
| 36 | + 'uid', |
|
| 37 | + 'username', |
|
| 38 | + 'name', |
|
| 39 | + 'first_name', |
|
| 40 | + 'last_name', |
|
| 41 | + 'address', |
|
| 42 | + 'telephone', |
|
| 43 | + 'fax', |
|
| 44 | + 'email', |
|
| 45 | + 'title', |
|
| 46 | + 'zip', |
|
| 47 | + 'city', |
|
| 48 | + 'country', |
|
| 49 | + 'company', |
|
| 50 | + 'usergroup', |
|
| 51 | + StandardFacet::class => [ |
|
| 52 | + 'name' => 'disable', |
|
| 53 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
| 54 | + 'suggestions' => [ |
|
| 55 | + '0' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.0', |
|
| 56 | + '1' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.1' |
|
| 57 | + ] |
|
| 58 | + ], |
|
| 59 | + PageFacet::class => [ |
|
| 60 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
| 61 | + ], |
|
| 62 | + ], |
|
| 63 | + 'columns' => [ |
|
| 64 | + '__checkbox' => [ |
|
| 65 | + 'renderer' => CheckBoxRenderer::class, |
|
| 66 | + ], |
|
| 67 | + 'uid' => [ |
|
| 68 | + 'visible' => false, |
|
| 69 | + 'label' => 'Id', |
|
| 70 | + 'width' => '5px', |
|
| 71 | + ], |
|
| 72 | + 'username' => [ |
|
| 73 | + 'visible' => true, |
|
| 74 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:username', |
|
| 75 | + 'editable' => true, |
|
| 76 | + ], |
|
| 77 | + 'name' => [ |
|
| 78 | + 'visible' => true, |
|
| 79 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:name', |
|
| 80 | + 'editable' => true, |
|
| 81 | + ], |
|
| 82 | + 'email' => [ |
|
| 83 | + 'visible' => true, |
|
| 84 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:email', |
|
| 85 | + 'editable' => true, |
|
| 86 | + ], |
|
| 87 | + 'usergroup' => [ |
|
| 88 | + 'visible' => true, |
|
| 89 | + 'renderers' => [ |
|
| 90 | + 'Fab\Vidi\Grid\RelationEditRenderer', |
|
| 91 | + 'Fab\Vidi\Grid\RelationRenderer', |
|
| 92 | + ], |
|
| 93 | + 'editable' => true, |
|
| 94 | + 'sortable' => false, |
|
| 95 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:usergroup', |
|
| 96 | + ], |
|
| 97 | + 'tstamp' => [ |
|
| 98 | + 'visible' => false, |
|
| 99 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
| 100 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
| 101 | + ], |
|
| 102 | + 'crdate' => [ |
|
| 103 | + 'visible' => false, |
|
| 104 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
| 105 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
| 106 | + ], |
|
| 107 | + #'disable' => [ |
|
| 108 | + # 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
| 109 | + # 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', |
|
| 110 | + # 'width' => '3%', |
|
| 111 | + #], |
|
| 112 | + '__buttons' => [ |
|
| 113 | + 'renderer' => ButtonGroupRenderer::class, |
|
| 114 | + ], |
|
| 115 | + ], |
|
| 116 | + ], |
|
| 117 | 117 | ]; |
| 118 | 118 | |
| 119 | 119 | ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['fe_users'], $tca); |
@@ -6,62 +6,62 @@ |
||
| 6 | 6 | use TYPO3\CMS\Core\Utility\ArrayUtility; |
| 7 | 7 | |
| 8 | 8 | if (!defined('TYPO3')) { |
| 9 | - die('Access denied.'); |
|
| 9 | + die('Access denied.'); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | $tca = [ |
| 13 | - 'vidi' => [ |
|
| 14 | - // Special case when the field name does not follow the conventions. |
|
| 15 | - // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
| 16 | - 'mappings' => [ |
|
| 17 | - 'lockToDomain' => 'lockToDomain', |
|
| 18 | - 'TSconfig' => 'tsConfig', |
|
| 19 | - 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
| 20 | - ], |
|
| 21 | - ], |
|
| 22 | - 'grid' => [ |
|
| 23 | - 'facets' => [ |
|
| 24 | - 'uid', |
|
| 25 | - 'title', |
|
| 26 | - 'description', |
|
| 27 | - PageFacet::class => [ |
|
| 28 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
| 29 | - ] |
|
| 30 | - ], |
|
| 31 | - 'columns' => [ |
|
| 32 | - '__checkbox' => [ |
|
| 33 | - 'renderer' => CheckBoxRenderer::class, |
|
| 34 | - ], |
|
| 35 | - 'uid' => [ |
|
| 36 | - 'visible' => false, |
|
| 37 | - 'label' => 'Id', |
|
| 38 | - 'width' => '5px', |
|
| 39 | - ], |
|
| 40 | - 'title' => [ |
|
| 41 | - 'visible' => true, |
|
| 42 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf:title', |
|
| 43 | - 'editable' => true, |
|
| 44 | - ], |
|
| 45 | - 'tstamp' => [ |
|
| 46 | - 'visible' => false, |
|
| 47 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
| 48 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
| 49 | - ], |
|
| 50 | - 'crdate' => [ |
|
| 51 | - 'visible' => false, |
|
| 52 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
| 53 | - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
| 54 | - ], |
|
| 55 | - #'hidden' => [ |
|
| 56 | - # 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
| 57 | - # 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:visibility_abbreviation', |
|
| 58 | - # 'width' => '3%', |
|
| 59 | - #], |
|
| 60 | - '__buttons' => [ |
|
| 61 | - 'renderer' => ButtonGroupRenderer::class, |
|
| 62 | - ], |
|
| 63 | - ] |
|
| 64 | - ] |
|
| 13 | + 'vidi' => [ |
|
| 14 | + // Special case when the field name does not follow the conventions. |
|
| 15 | + // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. |
|
| 16 | + 'mappings' => [ |
|
| 17 | + 'lockToDomain' => 'lockToDomain', |
|
| 18 | + 'TSconfig' => 'tsConfig', |
|
| 19 | + 'felogin_redirectPid' => 'feLoginRedirectPid', |
|
| 20 | + ], |
|
| 21 | + ], |
|
| 22 | + 'grid' => [ |
|
| 23 | + 'facets' => [ |
|
| 24 | + 'uid', |
|
| 25 | + 'title', |
|
| 26 | + 'description', |
|
| 27 | + PageFacet::class => [ |
|
| 28 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' |
|
| 29 | + ] |
|
| 30 | + ], |
|
| 31 | + 'columns' => [ |
|
| 32 | + '__checkbox' => [ |
|
| 33 | + 'renderer' => CheckBoxRenderer::class, |
|
| 34 | + ], |
|
| 35 | + 'uid' => [ |
|
| 36 | + 'visible' => false, |
|
| 37 | + 'label' => 'Id', |
|
| 38 | + 'width' => '5px', |
|
| 39 | + ], |
|
| 40 | + 'title' => [ |
|
| 41 | + 'visible' => true, |
|
| 42 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf:title', |
|
| 43 | + 'editable' => true, |
|
| 44 | + ], |
|
| 45 | + 'tstamp' => [ |
|
| 46 | + 'visible' => false, |
|
| 47 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
| 48 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', |
|
| 49 | + ], |
|
| 50 | + 'crdate' => [ |
|
| 51 | + 'visible' => false, |
|
| 52 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
| 53 | + 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', |
|
| 54 | + ], |
|
| 55 | + #'hidden' => [ |
|
| 56 | + # 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', |
|
| 57 | + # 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:visibility_abbreviation', |
|
| 58 | + # 'width' => '3%', |
|
| 59 | + #], |
|
| 60 | + '__buttons' => [ |
|
| 61 | + 'renderer' => ButtonGroupRenderer::class, |
|
| 62 | + ], |
|
| 63 | + ] |
|
| 64 | + ] |
|
| 65 | 65 | ]; |
| 66 | 66 | |
| 67 | 67 | ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['fe_groups'], $tca); |