コード例 #1
0
 /**
  * Returns an array containing the fields types configuration, based on the
  * TypoScript configuration of a given page.
  *
  * @param $pageUid    int    The id of the page you want the configuration of.
  * @return array    The fields types configuration as an array : key is the name and value is the configuration.
  * @throws \Exception
  */
 public static function getFieldsTypesConfiguration($pageUid)
 {
     if (!isset(self::$fieldsTypes[$pageUid])) {
         $fieldsTypesConfiguration = TypoScriptUtility::getExtensionConfigurationFromPath('fieldsTypes', $pageUid);
         self::$fieldsTypes[$pageUid] = [];
         foreach ($fieldsTypesConfiguration as $fieldTypeName => $fieldTypeConfiguration) {
             if (!isset($fieldTypeConfiguration['class'])) {
                 throw new \Exception('The field type "' . $fieldTypeName . '" should have a value for "class"', 1423770370);
             }
             self::$fieldsTypes[$pageUid][$fieldTypeName] = $fieldTypeConfiguration;
         }
     }
     return self::$fieldsTypes[$pageUid];
 }
コード例 #2
0
 /**
  * Returns the fields configuration of a given page.
  *
  * @param	$pageUid	int		The id of the page you want the fields of.
  * @return	array				The fields configuration.
  */
 private static function getFieldsConfiguration($pageUid)
 {
     if (!isset(self::$fieldsConfiguration[$pageUid])) {
         self::$fieldsConfiguration[$pageUid] = Core::sortArrayByPositionValue(TypoScriptUtility::getExtensionConfigurationFromPath('fields', $pageUid));
     }
     return self::$fieldsConfiguration[$pageUid];
 }
コード例 #3
0
 /**
  * This function will, at its first call, process a clean of the process
  * configuration.
  * The configuration will be stored in cache to increase performances for
  * future calls.
  *
  * @param $pageUid						int		The uid of the page where to get the configuration.
  * @param $onlyUsedInSiteModification	bool	Set to true if you only want the configuration which will be used during a modification, not a creation.
  * @return array The cleaned configuration.
  */
 public static function getCleanedDuplicationConfiguration($pageUid, $onlyUsedInSiteModification = false)
 {
     // As the result stored in cache may differ with $onlyUsedInSiteModification, we need to store the data in a different cache file.
     $siteModificationToken = $onlyUsedInSiteModification ? '1' : '0';
     if (!self::$duplicationConfiguration[$pageUid][$siteModificationToken]) {
         $duplicationConfiguration = Core::sortArrayByPositionValue(TypoScriptUtility::getExtensionConfigurationFromPath('duplication', $pageUid));
         $cleanedDuplicationConfiguration = array();
         // For HTML convention causes, we replace the lower-camel-case indexes with lower-case-underscored ones.
         foreach ($duplicationConfiguration as $key => $configuration) {
             if ($onlyUsedInSiteModification) {
                 if (!$configuration['usedInSiteModification']) {
                     continue;
                 }
             }
             $newKey = GeneralUtility::camelCaseToLowerCaseUnderscored($key);
             $newKey = str_replace('_', '-', $newKey);
             $cleanedDuplicationConfiguration[$newKey] = $configuration;
         }
         self::$duplicationConfiguration[$pageUid][$siteModificationToken] = $cleanedDuplicationConfiguration;
     }
     return self::$duplicationConfiguration[$pageUid][$siteModificationToken];
 }
コード例 #4
0
 /**
  * Returns a string containing all the constants configuration for the
  * pages.
  *
  * @param	int		$pageUid				The page uid.
  * @param	array	$pageUidAssociation		Association of uid for the given page.
  * @return	string
  */
 private static function getTemplateConstantsUidAssociationString($pageUid, array $pageUidAssociation)
 {
     $constantsString = '';
     $pagesPaths = TypoScriptUtility::getExtensionConfigurationFromPath('constantsPaths.pagesPaths');
     if (!is_array($pagesPaths)) {
     } else {
         $constants = TypoScriptUtility::getTypoScriptConstants($pageUid);
         foreach ($pagesPaths as $path) {
             if (ArrayUtility::isValidPath($constants, $path, '.')) {
                 $pagesValues = ArrayUtility::getValueByPath($constants, $path, '.');
                 if (is_array($pagesValues)) {
                     foreach ($pagesValues as $pageName => $pageValue) {
                         if (array_key_exists($pageValue, $pageUidAssociation)) {
                             $constantsString .= $path . '.' . $pageName . ' = ' . $pageUidAssociation[$pageValue] . CRLF;
                         }
                     }
                 }
             }
         }
     }
     return $constantsString;
 }