1 config.inc public Config::getOverride($key)

Checks if a config value has an override specified.


string $key: The string that maps to a key with the configuration data.

A key may be overridden at any level, for example if $key === 'foo.bar.key1', the matched value could be provided by an override from 'foo.bar.key1', 'foo.bar', or 'foo'. In settings.php any of the following would provide an overridden value for 'foo.bar.key1':

  // Exact match.
  $config['example.settings']['foo.bar.key1'] = 'value1';

  // One level up.
  $config['example.settings']['foo.bar'] = array(
    'key1' => 'value1',

  // A root level override.
  $config['example.settings']['foo'] = array(
    'bar' => array(
      'key1' => 'value1',
      'key2' => 'value2',
    'baz' => 'other value',

See also




core/includes/config.inc, line 737
This is the API for configuration storage.


Defines the default configuration object.


public function getOverride($key) {
  $value = NULL;
  $parts = explode('.', (string) $key);
  $popped_parts = array();
  while ($parts) {
    $assembled_key = implode('.', $parts);
    if (isset($this->overrides[$assembled_key])) {
      // An override is matched at some level.
      $value = $this->overrides[$assembled_key];
      // Drill down back into the override value to get the requested key.
      foreach ($popped_parts as $popped_part) {
        if (isset($value[$popped_part])) {
          $value = $value[$popped_part];
        else {
          $value = NULL;
          $popped_parts = array();
    // If an override was not found at this key, go up a level in the key
    // and continue until there are no more $parts left.
    array_unshift($popped_parts, array_pop($parts));

  return $value;