Пример #1
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;
 }
 /**
  * Generate the TypoScript setup for the smart objects defined
  * within the extension
  *
  * @param string $extensionKey
  *
  * @return array
  */
 private function generateTypoScriptSetup($extensionKey)
 {
     $setup = [];
     foreach ($this->getSmartObjectsForExtensionKey($extensionKey) as $className) {
         $table = ModelUtility::getTableNameByModelReflectionAnnotation($className);
         $recordType = (string) ReflectionUtility::getFirstTagValue($className, 'recordType');
         $parentClass = (string) ReflectionUtility::getFirstTagValue($className, 'parentClass');
         if ($table !== '') {
             $setup[] = 'config.tx_extbase.persistence.classes.' . $className . '.mapping.tableName = ' . $table;
         }
         if ($recordType !== '') {
             $setup[] = 'config.tx_extbase.persistence.classes.' . $className . '.mapping.recordType = ' . $recordType;
         }
         if ($parentClass !== '') {
             $setup[] = 'config.tx_extbase.persistence.classes.' . $parentClass . '.subclasses.' . $className . ' = ' . $className;
         }
     }
     return $setup;
 }
Пример #3
0
 /**
  * get the smart exclude values e.g. language, workspace,
  * enableFields from the given model
  *
  * @param string $name
  *
  * @return array
  */
 public static function getSmartExcludesByModelName($name)
 {
     return GeneralUtility::trimExplode(',', (string) ReflectionUtility::getFirstTagValue($name, 'smartExclude'), true);
 }