本文整理汇总了PHP中TYPO3\CMS\Core\Utility\ArrayUtility::flatten方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayUtility::flatten方法的具体用法?PHP ArrayUtility::flatten怎么用?PHP ArrayUtility::flatten使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\ArrayUtility
的用法示例。
在下文中一共展示了ArrayUtility::flatten方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergeWithExistingConfiguration
/**
* Merge current local configuration over default configuration
*
* @param array $defaultConfiguration Default configuration from ext_conf_template.txt
* @param string $extensionKey the extension information
* @return array
*/
protected function mergeWithExistingConfiguration(array $defaultConfiguration, $extensionKey)
{
try {
$currentExtensionConfig = unserialize($this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class)->getConfigurationValueByPath('EXT/extConf/' . $extensionKey));
if (!is_array($currentExtensionConfig)) {
$currentExtensionConfig = array();
}
} catch (\RuntimeException $e) {
$currentExtensionConfig = array();
}
$flatExtensionConfig = ArrayUtility::flatten($currentExtensionConfig);
$valuedCurrentExtensionConfig = array();
foreach ($flatExtensionConfig as $key => $value) {
$valuedCurrentExtensionConfig[$key]['value'] = $value;
}
ArrayUtility::mergeRecursiveWithOverrule($defaultConfiguration, $valuedCurrentExtensionConfig);
return $defaultConfiguration;
}
示例2: flattenCalculatesExpectedResult
/**
* @test
* @param array $array
* @param array $expected
* @dataProvider flattenCalculatesExpectedResultDataProvider
*/
public function flattenCalculatesExpectedResult(array $array, array $expected)
{
$this->assertEquals($expected, ArrayUtility::flatten($array));
}
示例3: generateBackendLayoutFromTsConfig
/**
* Generates a Backend Layout from PageTsConfig array
*
* @return mixed
*/
protected function generateBackendLayoutFromTsConfig($identifier, $data)
{
if (!empty($data['config.']['backend_layout.']) && is_array($data['config.']['backend_layout.'])) {
$backendLayout['uid'] = substr($identifier, 0, -1);
$backendLayout['title'] = $data['title'] ? $data['title'] : $backendLayout['uid'];
$backendLayout['icon'] = $data['icon'] ? $data['icon'] : '';
/* Convert PHP array back to plain TypoScript so it can be procecced */
$config = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($data['config.']);
$backendLayout['config'] = '';
foreach ($config as $row => $value) {
$backendLayout['config'] .= $row . " = " . $value . "\r\n";
}
return $backendLayout;
}
return NULL;
}
示例4: mergeWithExistingConfiguration
/**
* Merge new configuration with existing configuration
*
* @param array $configuration the new configuration array
* @param array $extension the extension information
* @return array
*/
protected function mergeWithExistingConfiguration(array $configuration, array $extension)
{
try {
$currentExtensionConfig = unserialize($this->configurationManager->getConfigurationValueByPath('EXT/extConf/' . $extension['key']));
} catch (\RuntimeException $e) {
$currentExtensionConfig = array();
}
$flatExtensionConfig = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($currentExtensionConfig);
$valuedCurrentExtensionConfig = array();
foreach ($flatExtensionConfig as $key => $value) {
$valuedCurrentExtensionConfig[$key]['value'] = $value;
}
$configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($configuration, $valuedCurrentExtensionConfig);
return $configuration;
}
示例5: arrayIsFlat
/**
* @param array $array
* @param array $expected
* @test
* @dataProvider arrayIsFlatDataProvider
*/
public function arrayIsFlat(array $array, array $expected)
{
$this->assertEquals($expected, \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($array));
}
示例6: convertNestedToValuedConfiguration
/**
* Convert a nested configuration to a valued configuration
*
* array('first.' => array('second' => 1))
* will become
* array('first.second' => array('value' => 1)
* @param array $nestedConfiguration
* @return array
*/
public function convertNestedToValuedConfiguration(array $nestedConfiguration)
{
$flatExtensionConfig = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($nestedConfiguration);
$valuedCurrentExtensionConfig = array();
foreach ($flatExtensionConfig as $key => $value) {
$valuedCurrentExtensionConfig[$key]['value'] = $value;
}
return $valuedCurrentExtensionConfig;
}
示例7: mergeWithExistingConfiguration
/**
* Merge new configuration with existing configuration
*
* @param array $configuration the new configuration array
* @param array $extension the extension information
* @return array
*/
protected function mergeWithExistingConfiguration(array $configuration, array $extension)
{
$currentExtensionConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extension['key']]);
$flatExtensionConfig = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($currentExtensionConfig);
$valuedCurrentExtensionConfig = array();
foreach ($flatExtensionConfig as $key => $value) {
$valuedCurrentExtensionConfig[$key]['value'] = $value;
}
if (is_array($currentExtensionConfig)) {
$configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($configuration, $valuedCurrentExtensionConfig);
}
return $configuration;
}