setNestedArrayValue() публичный статический Метод

Set a nested value in an array.
См. также: Copied from \Drupal\Component\Utility\NestedArray::setValue()
public static setNestedArrayValue ( array &$array, array $parents, mixed $value, boolean $force = false )
$array array
$parents array
$value mixed
$force boolean
Пример #1
0
 protected function applyUserConfigOverrides()
 {
     // A whitelist of allowed overrides.
     $overrideMap = ['api' => 'api', 'local.copy_on_windows' => 'local.copy_on_windows', 'local.drush_executable' => 'local.drush_executable', 'experimental' => 'experimental', 'updates' => 'updates'];
     $userConfig = $this->getUserConfig();
     if (!empty($userConfig)) {
         foreach ($overrideMap as $userConfigKey => $configKey) {
             $value = Util::getNestedArrayValue($userConfig, explode('.', $userConfigKey), $exists);
             if ($exists) {
                 $configParents = explode('.', $configKey);
                 $default = Util::getNestedArrayValue(self::$config, $configParents, $defaultExists);
                 if ($defaultExists && is_array($default)) {
                     if (!is_array($value)) {
                         continue;
                     }
                     $value = array_replace_recursive($default, $value);
                 }
                 Util::setNestedArrayValue(self::$config, $configParents, $value, true);
             }
         }
     }
 }