/**
  * @test
  */
 public function canOperateArrayDiffFunction()
 {
     $array1 = array('bar' => TRUE, 'baz' => TRUE, 'same' => array('foo' => TRUE), 'foo' => array('bar' => TRUE, 'foo' => TRUE));
     $array2 = array('bar' => TRUE, 'baz' => FALSE, 'new' => TRUE, 'same' => array('foo' => TRUE), 'foo' => array('bar' => TRUE));
     $expected = array('baz' => TRUE, 'foo' => array('foo' => TRUE), 'new' => TRUE);
     $product = RecursiveArrayUtility::diff($array1, $array2);
     $this->assertSame($expected, $product);
 }
 /**
  * @test
  */
 public function canOperateMergeRecursiveOverruleFunction()
 {
     $array1 = array('foo' => array('bar' => TRUE));
     $array2 = array('foo' => array('foo' => TRUE, 'bar' => FALSE));
     $expected = array('foo' => array('bar' => FALSE, 'foo' => TRUE));
     $product = RecursiveArrayUtility::mergeRecursiveOverrule($array1, $array2);
     $this->assertSame($expected, $product);
 }
 /**
  * @return void
  */
 protected function initializeViewVariables()
 {
     $row = $this->getRecord();
     $form = $this->provider->getForm($row);
     $generalSettings = $this->configurationService->convertFlexFormContentToArray($row['pi_flexform'], $form);
     $contentSettings = $this->configurationService->convertFlexFormContentToArray($row['content_options'], $form);
     $this->settings = RecursiveArrayUtility::merge($this->settings, $generalSettings, FALSE, FALSE);
     if (FALSE === isset($this->settings['content'])) {
         $this->settings['content'] = $contentSettings;
     } else {
         $this->settings['content'] = RecursiveArrayUtility::merge($this->settings['content'], $contentSettings);
     }
     parent::initializeViewVariables();
 }
 /**
  * @return void
  */
 protected function initializeViewVariables($row)
 {
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->provider = $objectManager->get('FluidTYPO3\\FluidcontentCore\\Provider\\CoreContentProvider');
     $this->configurationService = $objectManager->get('FluidTYPO3\\Flux\\Service\\FluxService');
     $form = $this->provider->getForm($row);
     $generalSettings = $this->configurationService->convertFlexFormContentToArray($row['pi_flexform'], $form);
     $contentSettings = $this->configurationService->convertFlexFormContentToArray($row['content_options'], $form);
     $this->settings = RecursiveArrayUtility::merge($this->settings, $generalSettings, false, false);
     if (false === isset($this->settings['content'])) {
         $this->settings['content'] = $contentSettings;
     } else {
         $this->settings['content'] = RecursiveArrayUtility::merge($this->settings['content'], $contentSettings);
     }
 }
Exemple #5
0
 /**
  * @param string $extensionName
  * @return array|NULL
  */
 public function getViewConfigurationForExtensionName($extensionName)
 {
     $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionName);
     $configuration = $this->getDefaultViewConfigurationForExtensionKey($extensionKey);
     $subConfiguration = (array) $this->getTypoScriptSubConfiguration(NULL, 'view', $extensionKey);
     $configuration = RecursiveArrayUtility::merge($configuration, $subConfiguration);
     if (FALSE === is_array($configuration)) {
         $this->message('Template paths resolved for "' . $extensionName . '" was not an array.', GeneralUtility::SYSLOG_SEVERITY_WARNING);
         $configuration = NULL;
     }
     return $configuration;
 }
 /**
  * @param array $row
  * @return array
  */
 protected function getInheritedConfiguration(array $row)
 {
     $tableName = $this->getTableName($row);
     $tableFieldName = $this->getFieldName($row);
     $cacheKey = $tableName . $tableFieldName . $row['uid'];
     if (false === isset(self::$cache[$cacheKey])) {
         $tree = $this->getInheritanceTree($row);
         $data = [];
         foreach ($tree as $branch) {
             /** @var SubPageProvider $provider */
             $provider = $this->pageConfigurationService->resolvePrimaryConfigurationProvider($this->tableName, self::FIELD_NAME_SUB, $branch);
             $form = $provider->getForm($branch);
             if (null === $form) {
                 continue;
             }
             $fields = $form->getFields();
             $values = $provider->getFlexFormValuesSingle($branch);
             foreach ($fields as $field) {
                 $values = $this->unsetInheritedValues($field, $values);
             }
             $data = RecursiveArrayUtility::merge($data, $values);
         }
         self::$cache[$cacheKey] = $data;
     }
     return self::$cache[$cacheKey];
 }
 /**
  * @param array $tree
  * @param string $cacheKey Overrides the cache key
  * @param boolean $mergeToCache Merges the configuration of $tree to the current $cacheKey
  * @return array
  */
 protected function getMergedConfiguration(array $tree, $cacheKey = NULL, $mergeToCache = FALSE)
 {
     if (NULL === $cacheKey) {
         $cacheKey = $this->getCacheKeyForMergedConfiguration($tree);
     }
     if (FALSE === $mergeToCache && TRUE === $this->hasCacheForMergedConfiguration($cacheKey)) {
         return self::$cache[$cacheKey];
     }
     $data = array();
     foreach ($tree as $branch) {
         $form = $this->getForm($branch);
         if (NULL === $form) {
             self::$cache[$cacheKey] = $data;
             return $data;
         }
         $fields = $form->getFields();
         $values = $this->getFlexFormValues($branch);
         foreach ($fields as $field) {
             $name = $field->getName();
             $stop = TRUE === $field->getStopInheritance();
             $inherit = TRUE === $field->getInheritEmpty();
             $empty = TRUE === empty($values[$name]) && $values[$name] !== '0' && $values[$name] !== 0;
             if (TRUE === $stop || FALSE === $inherit && TRUE === $empty) {
                 unset($values[$name]);
             }
         }
         $data = RecursiveArrayUtility::merge($data, $values);
     }
     if (TRUE === $mergeToCache && TRUE === $this->hasCacheForMergedConfiguration($cacheKey)) {
         $data = RecursiveArrayUtility::merge(self::$cache[$cacheKey], $data);
     }
     self::$cache[$cacheKey] = $data;
     return $data;
 }
$GLOBALS['TCA']['pages']['types'] = \FluidTYPO3\Flux\Utility\RecursiveArrayUtility::mergeRecursiveOverrule($GLOBALS['TCA']['pages']['types'], [(string) \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_DEFAULT => ['showitem' => '
        		--div--;Properties,
        			--palette--;Document Title;document_title,
					tx_fed_page_controller_action,
					tx_fed_page_flexform,
					categories,
					--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.media;media,
		' . $common], (string) \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_LINK => ['showitem' => '
            --div--;Properties,
            	--palette--;Document Title;document_title,
            	--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.external;external,
            	categories,
				--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.media;media,
		' . $common], (string) \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SHORTCUT => ['showitem' => '
            --div--;Properties,
       			--palette--;Document Title;document_title,
           		--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.shortcut;shortcut,
				categories,
				--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.media;media,
			' . $common], (string) \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_MOUNTPOINT => ['showitem' => '
				--div--;Properties,
					--palette--;Document Title;document_title,
            		--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.mountpoint;mountpoint,
				categories,
				--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.media;media,
			' . $common], (string) \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SYSFOLDER => ['showitem' => '
        		--div--;Properties,
        			--palette--;Document Title;document_title,
					categories,
					--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.media;media,
			' . $common], (string) \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SPACER => ['showitem' => '
        		--div--;Properties,
        			--palette--;Document Title;document_title,
				--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,
					--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.visibility;visibility,
					--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access,
				--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.behaviour,
					--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.miscellaneous;adminsonly,
				--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.extended,
			'], (string) \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER => ['showitem' => '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.standard;standard,
					--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.title;titleonly,
				--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.access,
					--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.visibility;hiddenonly,
				--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.behaviour,
					--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.miscellaneous;adminsonly,
				--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.extended,
		']]);
Exemple #9
0
 /**
  * @param array $row
  * @return array
  */
 protected function getInheritedConfiguration(array $row)
 {
     $tableName = $this->getTableName($row);
     $tableFieldName = $this->getFieldName($row);
     $cacheKey = $tableName . $tableFieldName . $row['uid'];
     if (TRUE === empty(self::$cache[$cacheKey])) {
         $tree = $this->getInheritanceTree($row);
         $data = array();
         foreach ($tree as $branch) {
             $provider = $this->configurationService->resolvePrimaryConfigurationProvider($this->tableName, self::FIELD_NAME_SUB, $branch);
             $form = $provider->getForm($branch);
             if (NULL === $form) {
                 break;
             }
             $fields = $form->getFields();
             $values = $provider->getFlexFormValuesSingle($branch);
             foreach ($fields as $field) {
                 $values = $this->unsetInheritedValues($field, $values);
             }
             $data = RecursiveArrayUtility::merge($data, $values);
         }
         self::$cache[$cacheKey] = $data;
     }
     return self::$cache[$cacheKey];
 }
 /**
  * @param string $qualifiedExtensionName
  * @param Form $form
  * @return void
  * @throws \RuntimeException
  */
 public function registerModuleBasedOnFluxForm($qualifiedExtensionName, Form $form)
 {
     $extensionKey = ExtensionNamingUtility::getExtensionKey($qualifiedExtensionName);
     $signature = ExtensionNamingUtility::getExtensionSignature($qualifiedExtensionName);
     $options = $form->getOption('Fluidbackend');
     $formId = $form->getName();
     $module = 'web';
     if (TRUE === isset($options[Constants::FORM_OPTION_MODULE_GROUP])) {
         $module = $options[Constants::FORM_OPTION_MODULE_GROUP];
     }
     $position = 'before:help';
     if (TRUE === isset($options[Constants::FORM_OPTION_MODULE_POSITION])) {
         $position = $options[Constants::FORM_OPTION_MODULE_POSITION];
     }
     $navigationComponent = '';
     if (TRUE === isset($options[Constants::FORM_OPTION_MODULE_PAGE_TREE]) && TRUE === (bool) $options[Constants::FORM_OPTION_MODULE_PAGE_TREE]) {
         $navigationComponent = 'typo3-pagetree';
     }
     $icon = MiscellaneousUtility::getIconForTemplate($form);
     if (TRUE === empty($icon)) {
         $icon = 'EXT:' . $extensionKey . '/ext_icon.gif';
     }
     if (NULL === $this->getResolver()->resolveFluxControllerClassNameByExtensionKeyAndAction($qualifiedExtensionName, 'render', 'Backend')) {
         throw new \RuntimeException('Attempt to register a Backend controller without an associated BackendController. Extension key: ' . $extensionKey, 1368826271);
     }
     $moduleConfiguration = array('access' => 'user,group', 'icon' => $icon, 'labels' => 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_module_' . $formId . '.xlf');
     if (FALSE === empty($navigationComponent)) {
         $moduleConfiguration['navigationComponentId'] = $navigationComponent;
     }
     $moduleSignature = 'tx_' . $signature . '_' . ucfirst($formId);
     if (FALSE === isset($GLOBALS['TBE_MODULES'][$module])) {
         if (FALSE === strpos($position, ':')) {
             if ('top' === $position) {
                 $temp_TBE_MODULES = array($module => '');
                 $temp_TBE_MODULES = RecursiveArrayUtility::mergeRecursiveOverrule($temp_TBE_MODULES, $GLOBALS['TBE_MODULES']);
             } else {
                 $temp_TBE_MODULES = (array) $GLOBALS['TBE_MODULES'];
                 $temp_TBE_MODULES[$module] = '';
             }
         } else {
             list($command, $relativeKey) = explode(':', $position);
             foreach ($GLOBALS['TBE_MODULES'] as $key => $val) {
                 if ($key === $relativeKey) {
                     if ('before' === $command) {
                         $temp_TBE_MODULES[$module] = '';
                         $temp_TBE_MODULES[$key] = $val;
                     } else {
                         $temp_TBE_MODULES[$key] = $val;
                         $temp_TBE_MODULES[$module] = '';
                     }
                 } else {
                     $temp_TBE_MODULES[$key] = $val;
                 }
             }
         }
         $GLOBALS['TBE_MODULES'] = (array) $temp_TBE_MODULES;
         // register pseudo-module acting as group header
         $moduleConfiguration['labels'] = 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_modulegroup.xlf';
         ExtensionUtility::registerModule($qualifiedExtensionName, $module, '', $position, array('Backend' => 'render,save'), $moduleConfiguration);
     }
     // register individual module in group
     $moduleConfiguration['labels'] = 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_module_' . $formId . '.xlf';
     ExtensionUtility::registerModule($qualifiedExtensionName, $module, $moduleSignature, $position, array('Backend' => 'render,save'), $moduleConfiguration);
 }
<?php

if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
//$GLOBALS['TCA']['tt_content']['ctrl']['formattedLabel_userFunc'] = \SimpleTYPO3\ContentNodeType\Hooks\Labels::class . '->propertiesBasedTitle';
//
//$GLOBALS['TCA']['tt_content']['ctrl']['label_userFunc'] = \SimpleTYPO3\ContentNodeType\Hooks\Labels::class . '->propertiesBasedTitle';
//--palette--;;key_line,
$GLOBALS['TCA']['tt_content']['palettes'] = \FluidTYPO3\Flux\Utility\RecursiveArrayUtility::mergeRecursiveOverrule($GLOBALS['TCA']['tt_content']['palettes'], ['key_line' => ['showitem' => 'header;Content Element Key,hidden;Hide this element?']]);
$common = '
        --div--;Common Properties,
                --palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.frames;frames,
        --div--;Content Node Properties,
                --palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.general;general,
        --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access,
                --palette--;LLL:EXT:cms/locallang_ttc.xlf:palette.access;access,
        --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.extended
        ';
$GLOBALS['TCA']['tt_content']['types']['list']['showitem'] = '
        --div--;Properties,
				--palette--;;key_line,
                list_type;LLL:EXT:cms/locallang_ttc.xlf:list_type_formlabel,
                select_key;LLL:EXT:cms/locallang_ttc.xlf:select_key_formlabel,
                pages;LLL:EXT:cms/locallang_ttc.xlf:pages.ALT.list_formlabel,
                recursive,
' . $common;
$GLOBALS['TCA']['tt_content']['types']['fluidcontent_content']['showitem'] = '
        --div--;Properties,
                --palette--;;key_line,
                pi_flexform,
Exemple #12
0
 /**
  * @param array $providers
  * @param array $record
  * @param string $field
  * @return array
  */
 protected static function readDataArrayFromProvidersOrUsingDefaultMethod(array $providers, $record, $field)
 {
     if (0 === count($providers)) {
         $lang = static::getCurrentLanguageName();
         $pointer = static::getCurrentValuePointerName();
         $dataArray = static::$configurationService->convertFlexFormContentToArray($record[$field], NULL, $lang, $pointer);
     } else {
         $dataArray = array();
         /** @var ProviderInterface $provider */
         foreach ($providers as $provider) {
             $data = (array) $provider->getFlexFormValues($record);
             $dataArray = RecursiveArrayUtility::merge($dataArray, $data);
         }
     }
     return $dataArray;
 }
Exemple #13
0
 /**
  * @param array $row
  * @return array
  */
 protected function getViewVariables(array $row)
 {
     $extensionKey = $this->getExtensionKey($row);
     $fieldName = $this->getFieldName($row);
     $variables = array('record' => $row, 'settings' => $this->configurationService->getSettingsForExtensionName($extensionKey));
     // Special case: when saving a new record variable $row[$fieldName] is already an array
     // and must not be processed by the configuration service. This has limited support from
     // Flux (essentially: no Form instance which means no inheritance, transformation or
     // form options can be dependended upon at this stage).
     $lang = $this->getCurrentLanguageName();
     $value = $this->getCurrentValuePointerName();
     if (FALSE === is_array($row[$fieldName])) {
         $recordVariables = $this->configurationService->convertFlexFormContentToArray($row[$fieldName], NULL, $lang, $value);
         $variables = RecursiveArrayUtility::mergeRecursiveOverrule($variables, $recordVariables);
     }
     $variables = RecursiveArrayUtility::mergeRecursiveOverrule($this->templateVariables, $variables);
     return $variables;
 }
Exemple #14
0
 /**
  * Modify properties of this FluxPackage (in this class
  * instance only) by passing an array using the same
  * structure as the constructor and as in the manifest.
  *
  * Is used internally when applying compatibility values:
  * the "overlay" type subset of version dependent values
  * is detected based on current version and passed to
  * this function which then assimilates the values.
  *
  * @param array $alternativeManifestDeclaration
  * @return void
  */
 public function modify(array $alternativeManifestDeclaration)
 {
     RecursiveArrayUtility::mergeRecursiveOverrule($this->manifest, $alternativeManifestDeclaration);
 }
Exemple #15
0
 /**
  * @return void
  */
 protected function initializeOverriddenSettings()
 {
     $row = $this->getRecord();
     $extensionKey = $this->provider->getExtensionKey($row);
     $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionKey);
     if (TRUE === isset($this->data['settings']) && TRUE === is_array($this->data['settings'])) {
         // a "settings." array is defined in the flexform configuration - extract it, use as "settings" in template
         // as well as the internal $this->settings array as per expected Extbase behavior.
         $this->settings = RecursiveArrayUtility::merge($this->settings, $this->data['settings']);
     }
     if (TRUE === isset($this->settings['useTypoScript']) && TRUE === (bool) $this->settings['useTypoScript']) {
         // an override shared by all Flux enabled controllers: setting plugin.tx_EXTKEY.settings.useTypoScript = 1
         // will read the "settings" array from that location instead - thus excluding variables from the flexform
         // which are still available as $this->data but no longer available automatically in the template.
         $this->settings = $this->configurationService->getSettingsForExtensionName($extensionKey);
     }
 }
 /**
  * Render method
  * @param string $table
  * @param string $field
  * @param integer $uid
  * @param array $record
  * @param string $as
  * @return array
  * @throws Exception
  */
 public function render($table, $field, $uid = NULL, $record = NULL, $as = NULL)
 {
     if (NULL === $uid && NULL !== $record && TRUE === isset($record['uid'])) {
         $uid = $record['uid'];
     }
     if (TRUE === isset(self::$dataCache[$uid . $table . $field])) {
         $dataArray = self::$dataCache[$uid . $table . $field];
     } elseif (TRUE === isset($GLOBALS['TCA'][$table]) && TRUE === isset($GLOBALS['TCA'][$table]['columns'][$field])) {
         if (NULL === $record) {
             $record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid,' . $field, $table, sprintf('uid=%d', $uid));
         }
         if (FALSE === $record) {
             throw new Exception(sprintf('Either table "%s", field "%s" or record with uid %d do not exist and you did not manually ' . 'provide the "row" attribute.', $table, $field, $uid), 1358679983);
         }
         $providers = $this->configurationService->resolveConfigurationProviders($table, $field, $record);
         if (0 === count($providers)) {
             $dataArray = $this->configurationService->convertFlexFormContentToArray($record[$field]);
         } else {
             $dataArray = array();
             foreach ($providers as $provider) {
                 $data = (array) $provider->getFlexFormValues($record);
                 $dataArray = RecursiveArrayUtility::merge($dataArray, $data);
             }
         }
         self::$dataCache[$uid . $table . $field] = $dataArray;
     } else {
         throw new Exception('Invalid table:field "' . $table . ':' . $field . '" - does not exist in TYPO3 TCA.', 1387049117);
     }
     if (NULL !== $as) {
         if ($this->templateVariableContainer->exists($as)) {
             $backupVariable = $this->templateVariableContainer->get($as);
             $this->templateVariableContainer->remove($as);
         }
         $this->templateVariableContainer->add($as, $dataArray);
         $content = $this->renderChildren();
         $this->templateVariableContainer->remove($as);
         if (TRUE === isset($backupVariable)) {
             $this->templateVariableContainer->add($as, $backupVariable);
         }
         return $content;
     }
     return $dataArray;
 }
Exemple #17
0
 /**
  * Returns the page record with localisation applied, if any
  * exists in database.
  *
  * @return array
  */
 protected function getPageValues()
 {
     $record = $GLOBALS['TSFE']->page;
     $localisation = $this->recordService->get('pages_language_overlay', '*', "pid = '" . $record['uid'] . "'");
     if (FALSE === empty($localisation)) {
         $record = RecursiveArrayUtility::merge($record, reset($localisation));
     }
     return $record;
 }
Exemple #18
0
 /**
  * @param ProviderInterface $provider
  * @param array $row
  * @param Form $form
  * @return string|NULL
  */
 protected function renderPreviewSection(ProviderInterface $provider, array $row, Form $form = NULL)
 {
     $templatePathAndFilename = $provider->getTemplatePathAndFilename($row);
     if (NULL === $templatePathAndFilename) {
         return NULL;
     }
     $extensionKey = $provider->getExtensionKey($row);
     $paths = $provider->getTemplatePaths($row);
     $flexformVariables = $provider->getFlexFormValues($row);
     $templateVariables = $provider->getTemplateVariables($row);
     $variables = RecursiveArrayUtility::merge($templateVariables, $flexformVariables);
     $variables['row'] = $row;
     $variables['record'] = $row;
     if (TRUE === is_object($form)) {
         $formLabel = $form->getLabel();
         $label = LocalizationUtility::translate($formLabel, $extensionKey);
         $variables['label'] = $label;
     }
     $templatePaths = new TemplatePaths($paths);
     $viewContext = new ViewContext($templatePathAndFilename, $extensionKey, self::CONTROLLER_NAME);
     $viewContext->setTemplatePaths($templatePaths);
     $viewContext->setVariables($variables);
     $view = $this->configurationService->getPreparedExposedTemplateView($viewContext);
     $existingContentObject = $this->configurationManager->getContentObject();
     $contentObject = new ContentObjectRenderer();
     $contentObject->start($row, $provider->getTableName($row));
     $this->configurationManager->setContentObject($contentObject);
     $previewContent = $view->renderStandaloneSection(self::PREVIEW_SECTION, $variables, TRUE);
     $this->configurationManager->setContentObject($existingContentObject);
     $previewContent = trim($previewContent);
     return $previewContent;
 }
Exemple #19
0
 /**
  * Returns the page record with localisation applied, if any
  * exists in database.
  *
  * @return array
  */
 protected function getPageValues()
 {
     $record = $GLOBALS['TSFE']->page;
     if ($GLOBALS['TSFE']->sys_language_uid != 0) {
         $localisation = $this->recordService->get('pages_language_overlay', '*', 'pid = "' . $record['uid'] . '" AND sys_language_uid = "' . $GLOBALS['TSFE']->sys_language_uid . '"');
     }
     if (FALSE === empty($localisation)) {
         $record = RecursiveArrayUtility::merge($record, reset($localisation));
     }
     return $record;
 }
 /**
  * @param string $name
  * @param mixed $value
  * @return FormInterface
  */
 public function setVariable($name, $value)
 {
     $this->variables = RecursiveArrayUtility::mergeRecursiveOverrule($this->variables, RecursiveArrayUtility::convertPathToArray($name, $value));
     return $this;
 }
 /**
  * @param array $tree
  * @param string $cacheKey Overrides the cache key
  * @param boolean $mergeToCache Merges the configuration of $tree to the current $cacheKey
  * @return array
  */
 protected function getMergedConfiguration(array $tree, $cacheKey = NULL, $mergeToCache = FALSE)
 {
     if (NULL === $cacheKey) {
         $cacheKey = $this->getCacheKeyForMergedConfiguration($tree);
     }
     if (FALSE === $mergeToCache && TRUE === $this->hasCacheForMergedConfiguration($cacheKey)) {
         return self::$cache[$cacheKey];
     }
     $data = array();
     foreach ($tree as $branch) {
         $form = $this->getForm($branch);
         if (NULL === $form) {
             self::$cache[$cacheKey] = $data;
             return $data;
         }
         $fields = $form->getFields();
         $values = $this->getFlexFormValues($branch);
         foreach ($fields as $field) {
             $values = $this->unsetInheritedValues($field, $values);
         }
         $data = RecursiveArrayUtility::merge($data, $values);
     }
     if (TRUE === $mergeToCache && TRUE === $this->hasCacheForMergedConfiguration($cacheKey)) {
         $data = RecursiveArrayUtility::merge(self::$cache[$cacheKey], $data);
     }
     self::$cache[$cacheKey] = $data;
     return $data;
 }
 /**
  * @param array $providers
  * @param array $record
  * @param string $field
  * @return array
  */
 protected function readDataArrayFromProvidersOrUsingDefaultMethod(array $providers, $record, $field)
 {
     if (0 === count($providers)) {
         $dataArray = $this->configurationService->convertFlexFormContentToArray($record[$field]);
     } else {
         $dataArray = array();
         foreach ($providers as $provider) {
             $data = (array) $provider->getFlexFormValues($record);
             $dataArray = RecursiveArrayUtility::merge($dataArray, $data);
         }
     }
     return $dataArray;
 }
Exemple #23
0
 /**
  * Returns the plugin.tx_extsignature.view array,
  * or a default set of paths if that array is not
  * defined in TypoScript.
  *
  * @param string $extensionName
  * @return array|NULL
  */
 public function getViewConfigurationForExtensionName($extensionName)
 {
     $signature = ExtensionNamingUtility::getExtensionSignature($extensionName);
     $defaults = (array) $this->getDefaultViewConfigurationForExtensionKey($extensionName);
     $configuration = (array) $this->getTypoScriptByPath('plugin.tx_' . $signature . '.view');
     return RecursiveArrayUtility::mergeRecursiveOverrule($defaults, $configuration);
 }
Exemple #24
0
 /**
  * @return void
  */
 public function initializeOverriddenSettings()
 {
     $this->settings = RecursiveArrayUtility::merge($this->settings, $this->data['settings']);
 }
Exemple #25
0
 /**
  * Returns the page record with localisation applied, if any
  * exists in database. Maintains uid and pid of the original
  * page if localisation is applied.
  *
  * @return array
  */
 protected function getPageValues()
 {
     $record = $GLOBALS['TSFE']->page;
     if ($GLOBALS['TSFE']->sys_language_uid != 0) {
         $localisation = $this->recordService->get('pages_language_overlay', '*', 'pid = "' . $record['uid'] . '" AND sys_language_uid = "' . $GLOBALS['TSFE']->sys_language_uid . '"' . ' AND hidden = false' . ' AND deleted = false' . ' AND (starttime = 0 OR starttime <= UNIX_TIMESTAMP())' . ' AND (endtime = 0 OR endtime > UNIX_TIMESTAMP())');
     }
     if (FALSE === empty($localisation)) {
         $mergedRecord = RecursiveArrayUtility::merge($record, reset($localisation));
         if (isset($record['uid']) && isset($record['pid'])) {
             $mergedRecord['uid'] = $record['uid'];
             $mergedRecord['pid'] = $record['pid'];
         }
         return $mergedRecord;
     }
     return $record;
 }
 /**
  * @return void
  */
 protected function initializeViewVariables()
 {
     $row = $this->getRecord();
     $flexFormData = $this->configurationService->convertFlexFormContentToArray($row['pi_flexform']);
     $this->settings = RecursiveArrayUtility::merge($this->settings, $flexFormData, FALSE, FALSE);
     parent::initializeViewVariables();
 }