Ejemplo n.º 1
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $autoLoader
  * @param int $type
  *
  * @return array
  */
 public function prepareLoader(Loader $autoLoader, $type)
 {
     $slots = [];
     $slotPath = ExtensionManagementUtility::extPath($autoLoader->getExtensionKey()) . 'Classes/Slots/';
     $slotClasses = FileUtility::getBaseFilesInDir($slotPath, 'php');
     foreach ($slotClasses as $slot) {
         $slotClass = ClassNamingUtility::getFqnByPath($autoLoader->getVendorName(), $autoLoader->getExtensionKey(), 'Slots/' . $slot);
         if (!$autoLoader->isInstantiableClass($slotClass)) {
             continue;
         }
         $methods = ReflectionUtility::getPublicMethods($slotClass);
         foreach ($methods as $methodReflection) {
             /** @var MethodReflection $methodReflection */
             $tagConfiguration = ReflectionUtility::getTagConfiguration($methodReflection, ['signalClass', 'signalName', 'signalPriority']);
             foreach ($tagConfiguration['signalClass'] as $key => $signalClass) {
                 if (!isset($tagConfiguration['signalName'][$key])) {
                     continue;
                 }
                 $priority = isset($tagConfiguration['signalPriority'][$key]) ? $tagConfiguration['signalPriority'][$key] : 0;
                 $priority = MathUtility::forceIntegerInRange($priority, 0, 100);
                 $slots[$priority][] = ['signalClassName' => trim($signalClass, '\\'), 'signalName' => $tagConfiguration['signalName'][$key], 'slotClassNameOrObject' => $slotClass, 'slotMethodName' => $methodReflection->getName()];
             }
         }
     }
     $slots = $this->flattenSlotsByPriority($slots);
     return $slots;
 }
Ejemplo n.º 2
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $hooks = [];
     $folder = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Hooks/';
     $files = FileUtility::getBaseFilesInDir($folder, 'php');
     foreach ($files as $hookFile) {
         $hookClass = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Hooks/' . $hookFile);
         if (!$loader->isInstantiableClass($hookClass)) {
             continue;
         }
         $classReflection = ReflectionUtility::createReflectionClass($hookClass);
         // add class hook
         $tagConfiguration = ReflectionUtility::getTagConfiguration($classReflection, ['hook']);
         if (sizeof($tagConfiguration['hook'])) {
             $hooks[] = ['locations' => $tagConfiguration['hook'], 'configuration' => $hookClass];
         }
         // add method hooks
         foreach ($classReflection->getMethods(MethodReflection::IS_PUBLIC) as $methodReflection) {
             /** @var $methodReflection \TYPO3\CMS\Extbase\Reflection\MethodReflection */
             $tagConfiguration = ReflectionUtility::getTagConfiguration($methodReflection, ['hook']);
             if (sizeof($tagConfiguration['hook'])) {
                 $hooks[] = ['locations' => $tagConfiguration['hook'], 'configuration' => $hookClass . '->' . $methodReflection->getName()];
             }
         }
     }
     return $hooks;
 }
Ejemplo n.º 3
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $autoLoader
  * @param int $type
  *
  * @return array
  */
 public function prepareLoader(Loader $autoLoader, $type)
 {
     $slots = [];
     $slotPath = ExtensionManagementUtility::extPath($autoLoader->getExtensionKey()) . 'Classes/Slots/';
     $slotClasses = FileUtility::getBaseFilesInDir($slotPath, 'php');
     $extKey = GeneralUtility::underscoredToUpperCamelCase($autoLoader->getExtensionKey());
     foreach ($slotClasses as $slot) {
         $slotClass = ClassNamingUtility::getFqnByPath($autoLoader->getVendorName(), $autoLoader->getExtensionKey(), 'Slots/' . $slot);
         if (!$autoLoader->isInstantiableClass($slotClass)) {
             continue;
         }
         $methods = ReflectionUtility::getPublicMethods($slotClass);
         foreach ($methods as $methodReflection) {
             /** @var MethodReflection $methodReflection */
             $tagConfiguration = ReflectionUtility::getTagConfiguration($methodReflection, ['signalClass', 'signalName']);
             foreach ($tagConfiguration['signalClass'] as $key => $signalClass) {
                 if (!isset($tagConfiguration['signalName'][$key])) {
                     continue;
                 }
                 $slots[] = ['signalClassName' => trim($signalClass, '\\'), 'signalName' => $tagConfiguration['signalName'][$key], 'slotClassNameOrObject' => $slotClass, 'slotMethodName' => $methodReflection->getName()];
             }
         }
     }
     return $slots;
 }
Ejemplo n.º 4
0
 /**
  * Check and create the TCA information
  * disable this for better performance
  */
 public static function checkAndCreateTcaInformation()
 {
     $register = SmartObjectRegister::getRegister();
     $baseTemplatePath = ExtensionManagementUtility::extPath('autoloader', 'Resources/Private/Templates/TcaFiles/');
     $defaultTemplate = GeneralUtility::getUrl($baseTemplatePath . 'Default.tmpl');
     $overrideTemplate = GeneralUtility::getUrl($baseTemplatePath . 'Override.tmpl');
     $search = ['__modelName__', '__tableName__', '__extensionKey__'];
     foreach ($register as $model) {
         $extensionKey = ClassNamingUtility::getExtensionKeyByModel($model);
         $basePath = ExtensionManagementUtility::extPath($extensionKey) . 'Configuration/TCA/';
         $tableName = ModelUtility::getTableNameByModelReflectionAnnotation($model);
         if ($tableName !== '') {
             $tcaFileName = $basePath . 'Overrides/' . $tableName . '.php';
             $template = $overrideTemplate;
         } else {
             $tableName = ModelUtility::getTableNameByModelName($model);
             $tcaFileName = $basePath . $tableName . '.php';
             $template = $defaultTemplate;
         }
         if (!is_file($tcaFileName)) {
             $replace = [str_replace('\\', '\\\\', $model), $tableName, $extensionKey];
             $content = str_replace($search, $replace, $template);
             FileUtility::writeFileAndCreateFolder($tcaFileName, $content);
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $pluginInformation = [];
     $controllerPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Controller/';
     $controllers = FileUtility::getBaseFilesRecursivelyInDir($controllerPath, 'php');
     foreach ($controllers as $controller) {
         $controllerName = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Controller/' . $controller);
         if (!$loader->isInstantiableClass($controllerName)) {
             continue;
         }
         $controllerKey = str_replace('/', '\\', $controller);
         $controllerKey = str_replace('Controller', '', $controllerKey);
         $methods = ReflectionUtility::getPublicMethods($controllerName);
         foreach ($methods as $method) {
             /** @var $method \TYPO3\CMS\Extbase\Reflection\MethodReflection */
             if ($method->isTaggedWith('plugin')) {
                 $pluginKeys = GeneralUtility::trimExplode(' ', implode(' ', $method->getTagValues('plugin')), true);
                 $actionName = str_replace('Action', '', $method->getName());
                 foreach ($pluginKeys as $pluginKey) {
                     $pluginInformation = $this->addPluginInformation($pluginInformation, $pluginKey, $controllerKey, $actionName, $method->isTaggedWith('noCache'));
                 }
             }
         }
     }
     return $pluginInformation;
 }
Ejemplo n.º 6
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $autoLoader
  * @param int $type
  *
  * @return array
  */
 public function prepareLoader(Loader $autoLoader, $type)
 {
     $servicePath = ExtensionManagementUtility::extPath($autoLoader->getExtensionKey()) . 'Classes/Service/Soap/';
     $serviceClasses = FileUtility::getBaseFilesRecursivelyInDir($servicePath, 'php');
     $info = [];
     foreach ($serviceClasses as $service) {
         $serviceClass = ClassNamingUtility::getFqnByPath($autoLoader->getVendorName(), $autoLoader->getExtensionKey(), 'Service/Soap/' . $service);
         $info[lcfirst($service)] = $serviceClass;
     }
     return $info;
 }
Ejemplo n.º 7
0
 /**
  * Render the content Element via ExtBase
  */
 public function indexAction()
 {
     $extensionKey = $this->settings['extensionKey'];
     $vendorName = $this->settings['vendorName'];
     $name = $this->settings['contentElement'];
     $data = $this->configurationManager->getContentObject()->data;
     $targetObject = ClassNamingUtility::getFqnByPath($vendorName, $extensionKey, 'Domain/Model/Content/' . $name);
     $model = ModelUtility::getModel($targetObject, $data);
     $view = $this->createStandaloneView();
     $view->assignMultiple(['data' => $data, 'object' => $model, 'settings' => $this->settings]);
     return $view->render();
 }
Ejemplo n.º 8
0
 /**
  * Get the absolute table icon for the given model name
  *
  * @param string  $modelClassName
  * @param boolean $extSyntax Get the EXT: Syntax instead of a rel Path
  *
  * @return string
  */
 public static function getByModelName($modelClassName, $extSyntax = false)
 {
     $modelInformation = ClassNamingUtility::explodeObjectModelName($modelClassName);
     $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($modelInformation['extensionName']);
     $modelName = str_replace('\\', '/', $modelInformation['modelName']);
     $tableIconPath = ExtensionManagementUtility::extPath($extensionKey) . 'Resources/Public/Icons/' . $modelName . '.';
     $fileExtension = self::getIconFileExtension($tableIconPath);
     if ($fileExtension) {
         return self::returnRelativeIconPath($extensionKey, 'Resources/Public/Icons/' . $modelName . '.' . $fileExtension, $extSyntax);
     }
     return self::getByExtensionKey($extensionKey, $extSyntax);
 }
Ejemplo n.º 9
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $autoLoader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $autoLoader, $type)
 {
     $classes = [];
     $converterPath = ExtensionManagementUtility::extPath($autoLoader->getExtensionKey()) . 'Classes/Property/TypeConverter/';
     $converterClasses = FileUtility::getBaseFilesRecursivelyInDir($converterPath, 'php', true);
     foreach ($converterClasses as $converterClass) {
         $converterClass = ClassNamingUtility::getFqnByPath($autoLoader->getVendorName(), $autoLoader->getExtensionKey(), 'Property/TypeConverter/' . $converterClass);
         if ($autoLoader->isInstantiableClass($converterClass)) {
             $classes[] = $converterClass;
         }
     }
     return $classes;
 }
Ejemplo n.º 10
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $classNames = [];
     $alternativeImpPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/AlternativeImplementations/';
     $alternativeClasses = FileUtility::getBaseFilesInDir($alternativeImpPath, 'php');
     foreach ($alternativeClasses as $aic) {
         $aicClass = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'AlternativeImplementations/' . $aic);
         if (!$loader->isInstantiableClass($aicClass)) {
             continue;
         }
         $classNames[] = ['originalName' => ReflectionUtility::getParentClassName($aicClass), 'alternativeClassName' => $aicClass];
     }
     return $classNames;
 }
Ejemplo n.º 11
0
 /**
  * Find table and model information for the given extension key
  *
  * @param string $extensionKey
  *
  * @return array
  */
 protected function findTableAndModelInformationForExtension($extensionKey)
 {
     $information = [];
     $register = SmartObjectRegister::getRegister();
     foreach ($register as $class) {
         $parts = ClassNamingUtility::explodeObjectModelName($class);
         if (GeneralUtility::camelCaseToLowerCaseUnderscored($parts['extensionName']) === $extensionKey) {
             if (ModelUtility::getTableNameByModelReflectionAnnotation($class) === '') {
                 $information[] = ['table' => ModelUtility::getTableNameByModelName($class), 'class' => $class];
             }
         }
     }
     return $information;
 }
Ejemplo n.º 12
0
 /**
  * Find table and model information for the given extension key
  *
  * @param string $extensionKey
  *
  * @return array
  */
 protected function findTableAndModelInformationForExtension($extensionKey)
 {
     $information = [];
     $register = SmartObjectRegister::getRegister();
     foreach ($register as $class) {
         $parts = ClassNamingUtility::explodeObjectModelName($class);
         if (GeneralUtility::camelCaseToLowerCaseUnderscored($parts['extensionName']) === $extensionKey) {
             if (ModelUtility::getTableNameByModelReflectionAnnotation($class) === '') {
                 $modelInformation = SmartObjectInformationService::getInstance()->getCustomModelFieldTca($class);
                 $information[] = ['table' => ModelUtility::getTableNameByModelName($class), 'properties' => array_keys($modelInformation)];
             }
         }
     }
     return $information;
 }
Ejemplo n.º 13
0
 /**
  * Prepare the content object loader
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $loaderInformation = [];
     $modelPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Domain/Model/Content/';
     $models = FileUtility::getBaseFilesInDir($modelPath, 'php');
     if ($models) {
         TranslateUtility::assureLabel('tt_content.' . $loader->getExtensionKey() . '.header', $loader->getExtensionKey(), $loader->getExtensionKey() . ' (Header)');
     }
     foreach ($models as $model) {
         $key = GeneralUtility::camelCaseToLowerCaseUnderscored($model);
         $className = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Domain/Model/Content/' . $model);
         if (!$loader->isInstantiableClass($className)) {
             continue;
         }
         $fieldConfiguration = [];
         $richTextFields = [];
         $noHeader = $this->isTaggedWithNoHeader($className);
         // create labels in the ext_tables run, to have a valid DatabaseConnection
         if ($type === LoaderInterface::EXT_TABLES) {
             TranslateUtility::assureLabel('wizard.' . $key, $loader->getExtensionKey(), $key . ' (Title)');
             TranslateUtility::assureLabel('wizard.' . $key . '.description', $loader->getExtensionKey(), $key . ' (Description)');
             $fieldConfiguration = $this->getClassPropertiesInLowerCaseUnderscored($className);
             $defaultFields = $this->getDefaultTcaFields(null, $noHeader);
             $fieldConfiguration = array_diff($fieldConfiguration, $defaultFields);
             // RTE manipulation
             $classReflection = ReflectionUtility::createReflectionClass($className);
             foreach ($classReflection->getProperties() as $property) {
                 /** @var $property PropertyReflection */
                 if ($property->isTaggedWith('enableRichText')) {
                     $search = array_search(GeneralUtility::camelCaseToLowerCaseUnderscored($property->getName()), $fieldConfiguration);
                     if ($search !== false) {
                         if (GeneralUtility::compat_version('7.0')) {
                             $richTextFields[] = $fieldConfiguration[$search];
                         } else {
                             $fieldConfiguration[$search] .= ';;;richtext:rte_transform[flag=rte_enabled|mode=ts_css]';
                         }
                     }
                 }
             }
         }
         $entry = ['fieldConfiguration' => implode(',', $fieldConfiguration), 'richTextFields' => $richTextFields, 'modelClass' => $className, 'model' => $model, 'icon' => IconUtility::getByModelName($className), 'iconExt' => IconUtility::getByModelName($className, true), 'noHeader' => $noHeader, 'tabInformation' => ReflectionUtility::getFirstTagValue($className, 'wizardTab')];
         SmartObjectRegister::register($entry['modelClass']);
         $loaderInformation[$key] = $entry;
     }
     $this->checkAndCreateDummyTemplates($loaderInformation, $loader);
     return $loaderInformation;
 }
Ejemplo n.º 14
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $autoLoader
  * @param int $type
  *
  * @return array
  */
 public function prepareLoader(Loader $autoLoader, $type)
 {
     $servicePath = ExtensionManagementUtility::extPath($autoLoader->getExtensionKey()) . 'Classes/Service/Json/';
     $serviceClasses = FileUtility::getBaseFilesRecursivelyInDir($servicePath, 'php');
     $info = [];
     foreach ($serviceClasses as $service) {
         $serviceClass = ClassNamingUtility::getFqnByPath($autoLoader->getVendorName(), $autoLoader->getExtensionKey(), 'Service/Json/' . $service);
         $legacyServiceName = lcfirst($service);
         if (array_key_exists($legacyServiceName, $info)) {
             trigger_error('Service "' . $service . '" already defined in: ' . $info[$legacyServiceName] . '!"', E_USER_NOTICE);
         }
         $info[$legacyServiceName] = $serviceClass;
         $serviceName = $autoLoader->getExtensionKey() . '/' . $service;
         $info[$serviceName] = $serviceClass;
     }
     return $info;
 }
Ejemplo n.º 15
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $loader
  * @param int $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $return = [];
     if ($type === LoaderInterface::EXT_TABLES) {
         return $return;
     }
     $xClassesPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Xclass/';
     $xClasses = FileUtility::getBaseFilesRecursivelyInDir($xClassesPath, 'php');
     foreach ($xClasses as $xClass) {
         $className = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Xclass/' . $xClass);
         if (!$loader->isInstantiableClass($className)) {
             continue;
         }
         $return[] = ['source' => ReflectionUtility::getParentClassName($className), 'target' => $className];
     }
     return $return;
 }
Ejemplo n.º 16
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $classNames = [];
     $commandPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Command/';
     $controllers = FileUtility::getBaseFilesInDir($commandPath, 'php');
     foreach ($controllers as $controller) {
         if ($controller === 'AbstractCommandController') {
             continue;
         }
         $className = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Command/' . $controller);
         if (!$loader->isInstantiableClass($className)) {
             continue;
         }
         $classNames[] = $className;
     }
     return $classNames;
 }
Ejemplo n.º 17
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $configuration = [];
     $modelPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Domain/Model/';
     if (!is_dir($modelPath)) {
         return $configuration;
     }
     $models = FileUtility::getBaseFilesRecursivelyInDir($modelPath, 'php');
     foreach ($models as $model) {
         $className = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Domain/Model/' . $model);
         if (SmartObjectManager::isSmartObjectClass($className)) {
             $configuration[] = $className;
         }
     }
     // already add for the following processes
     $this->addClassesToSmartRegister($configuration);
     return $configuration;
 }
Ejemplo n.º 18
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $loader
  * @param int $type
  *
  * @return array $loaderInformation
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $aspects = [];
     $aspectPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Aspect/';
     $aspectClasses = FileUtility::getBaseFilesInDir($aspectPath, 'php');
     $extKey = GeneralUtility::underscoredToUpperCamelCase($loader->getExtensionKey());
     foreach ($aspectClasses as $aspect) {
         $aspectClass = ClassNamingUtility::getFqnByPath($loader->getVendorName(), $loader->getExtensionKey(), 'Aspect/' . $aspect);
         if (!$loader->isInstantiableClass($aspectClass)) {
             continue;
         }
         try {
             $methods = ReflectionUtility::getPublicMethods($aspectClass);
             foreach ($methods as $methodReflection) {
                 /** @var $methodReflection \TYPO3\CMS\Extbase\Reflection\MethodReflection */
                 $tagConfiguration = ReflectionUtility::getTagConfiguration($methodReflection, ['aspectClass', 'aspectJoinPoint', 'aspectAdvice']);
                 foreach ($tagConfiguration['aspectClass'] as $key => $aspectClass) {
                     if (!isset($tagConfiguration['aspectJoinPoint'][$key]) || !isset($tagConfiguration['aspectAdvice'][$key])) {
                         continue;
                     }
                     $aspectClassName = trim($aspectClass, '\\');
                     $aspectJoinPoint = trim($tagConfiguration['aspectJoinPoint'][$key]);
                     // check only if class exists
                     if (!$loader->isInstantiableClass($aspectClassName)) {
                         continue;
                     }
                     $aspectJpArguments = $this->getMethodArgumentsFromClassMethod($aspectClassName, $aspectJoinPoint);
                     $aspects[] = ['aspectClassName' => $aspectClassName, 'aspectJoinPoint' => $aspectJoinPoint, 'aspectJoinPointArguments' => $aspectJpArguments, 'aspectAdvice' => trim($tagConfiguration['aspectAdvice'][$key]), 'originClassName' => $aspectClass, 'originMethodName' => $methodReflection->getName()];
                 }
             }
         } catch (\Exception $e) {
             // Class or file is not available for Aspects $aspectClassName
             continue;
         }
     }
     return $aspects;
 }
Ejemplo n.º 19
0
 /**
  * Get the smart objects for the given extension
  *
  * @param $extensionKey
  *
  * @return mixed
  */
 private function getSmartObjectsForExtensionKey($extensionKey)
 {
     $smartObjects = SmartObjectRegister::getRegister();
     $extensionObjects = [];
     foreach ($smartObjects as $className) {
         $objectExtension = ClassNamingUtility::getExtensionKeyByModel($className);
         if ($objectExtension === $extensionKey) {
             $extensionObjects[] = $className;
         }
     }
     return $extensionObjects;
 }
Ejemplo n.º 20
0
 /**
  * Get the default TCA incl. smart object fields.
  * Add missing fields to the existing TCA structure.
  *
  * @param string $extensionKey
  * @param string $tableName
  *
  * @return array
  */
 public static function getTcaOverrideInformation($extensionKey, $tableName)
 {
     $return = isset($GLOBALS['TCA'][$tableName]) ? $GLOBALS['TCA'][$tableName] : [];
     $classNames = SmartObjectRegister::getRegister();
     $informationService = SmartObjectInformationService::getInstance();
     foreach ($classNames as $className) {
         if (ClassNamingUtility::getExtensionKeyByModel($className) !== $extensionKey) {
             continue;
         }
         if (self::getTableNameByModelReflectionAnnotation($className) === $tableName) {
             $additionalTca = $informationService->getCustomModelFieldTca($className);
             foreach ($additionalTca as $fieldName => $configuration) {
                 if (!isset($return['columns'][$fieldName])) {
                     $return['columns'][$fieldName] = $configuration;
                 }
             }
         }
     }
     return $return;
 }
 /**
  * Pre build TCA information for the given model
  *
  * @param string $modelClassName
  *
  * @return array
  */
 public function getTcaInformation($modelClassName)
 {
     $modelInformation = ClassNamingUtility::explodeObjectModelName($modelClassName);
     $extensionName = GeneralUtility::camelCaseToLowerCaseUnderscored($modelInformation['extensionName']);
     $reflectionTableName = ModelUtility::getTableNameByModelReflectionAnnotation($modelClassName);
     $tableName = ModelUtility::getTableNameByModelName($modelClassName);
     $searchFields = [];
     $customFields = $this->getCustomModelFieldTca($modelClassName, $searchFields);
     if ($reflectionTableName !== '') {
         $customConfiguration = ['columns' => $customFields];
         $base = is_array($GLOBALS['TCA'][$reflectionTableName]) ? $GLOBALS['TCA'][$reflectionTableName] : [];
         return ArrayUtility::mergeRecursiveDistinct($base, $customConfiguration);
     }
     $excludes = ModelUtility::getSmartExcludesByModelName($modelClassName);
     $dataSet = $this->getDataSet();
     $dataImplementations = $dataSet->getAllAndExcludeList($excludes);
     $baseTca = $dataSet->getTcaInformation($dataImplementations, $tableName);
     // title
     $fields = array_keys($customFields);
     $labelField = 'title';
     if (!in_array($labelField, $fields)) {
         $labelField = $fields[0];
     }
     try {
         TranslateUtility::assureLabel($tableName, $extensionName);
     } catch (\Exception $ex) {
         // @todo handle
     }
     if (!is_array($baseTca['columns'])) {
         $baseTca['columns'] = [];
     }
     $baseTca['columns'] = ArrayUtility::mergeRecursiveDistinct($baseTca['columns'], $customFields);
     // items
     $showitem = $fields;
     if (!in_array('language', $excludes)) {
         $showitem[] = '--palette--;LLL:EXT:lang/locallang_general.xlf:LGL.language;language';
     }
     if (!in_array('workspaces', $excludes)) {
         $baseTca['ctrl']['shadowColumnsForNewPlaceholders'] .= ',' . $labelField;
     }
     if (GeneralUtility::compat_version('7.0')) {
         $languagePrefix = 'LLL:EXT:frontend/Resources/Private/Language/';
     } else {
         $languagePrefix = 'LLL:EXT:cms/';
     }
     if (!in_array('enableFields', $excludes)) {
         $showitem[] = '--div--;' . $languagePrefix . 'locallang_ttc.xlf:tabs.access';
         $showitem[] = '--palette--;' . $languagePrefix . 'locallang_tca.xlf:pages.palettes.access;access';
     }
     $showitem[] = '--div--;' . $languagePrefix . 'locallang_ttc.xlf:tabs.extended';
     $overrideTca = ['ctrl' => ['title' => TranslateUtility::getLllOrHelpMessage($tableName, $extensionName), 'label' => $labelField, 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'dividers2tabs' => true, 'sortby' => 'sorting', 'delete' => 'deleted', 'searchFields' => implode(',', $searchFields), 'iconfile' => IconUtility::getByModelName($modelClassName, GeneralUtility::compat_version('7.0'))], 'interface' => ['showRecordFieldList' => implode(',', array_keys($baseTca['columns']))], 'types' => ['1' => ['showitem' => implode(',', $showitem)]], 'palettes' => ['access' => ['showitem' => 'starttime, endtime, --linebreak--, hidden, editlock, --linebreak--, fe_group']]];
     return ArrayUtility::mergeRecursiveDistinct($baseTca, $overrideTca);
 }