mergeRecursiveOverrule() 공개 정적인 메소드

public static mergeRecursiveOverrule ( array $firstArray, array $secondArray, boolean $notAddKeys = FALSE, boolean $includeEmptyValues = TRUE, boolean $enableUnsetFeature = TRUE ) : array
$firstArray array First array
$secondArray array Second array, overruling the first array
$notAddKeys boolean If set, keys that are NOT found in $firstArray will not be set. Thus only existing value can/will be overruled from second array.
$includeEmptyValues boolean If set, values from $secondArray will overrule if they are empty or zero. Default: TRUE
$enableUnsetFeature boolean If set, special values "__UNSET" can be used in the second array in order to unset array keys in the resulting array.
리턴 array Resulting array where $secondArray values has overruled $firstArray values
예제 #1
0
 /**
  * @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);
 }
예제 #2
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;
 }
예제 #3
0
 /**
  * @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;
 }
예제 #4
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);
 }
예제 #5
0
 /**
  * @param string $operation
  * @param integer $id
  * @param array $row
  * @param DataHandler $reference
  * @param array $removals Additional array of field names to remove from the stored Flux value
  */
 public function postProcessRecord($operation, $id, array &$row, DataHandler $reference, array $removals = [])
 {
     if ('update' === $operation) {
         $record = $this->loadRecordFromDatabase($id);
         $record = RecursiveArrayUtility::mergeRecursiveOverrule($record, $reference->datamap[$this->tableName][$id]);
         $form = $this->getForm($record);
         if (null !== $form) {
             $tableFieldName = $this->getFieldName($record);
             foreach ($form->getFields() as $field) {
                 $fieldName = $field->getName();
                 $sheetName = $field->getParent()->getName();
                 $inherit = (bool) $field->getInherit();
                 $inheritEmpty = (bool) $field->getInheritEmpty();
                 if (isset($record[$tableFieldName]['data']) && is_array($record[$tableFieldName]['data'])) {
                     $value = $record[$tableFieldName]['data'][$sheetName]['lDEF'][$fieldName]['vDEF'];
                     $inheritedValue = $this->getInheritedPropertyValueByDottedPath($record, $fieldName);
                     $empty = true === empty($value) && $value !== '0' && $value !== 0;
                     $same = $inheritedValue == $value;
                     if (true === $same && true === $inherit || true === $inheritEmpty && true === $empty) {
                         $removals[] = $fieldName;
                     }
                 }
             }
         }
     }
     parent::postProcessRecord($operation, $id, $row, $reference, $removals);
 }
예제 #6
0
$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,
		']]);
 /**
  * @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);
 }
예제 #8
0
<?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,
예제 #9
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);
 }