Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Config.php

function Config::hasOverrides

Determines if overrides are applied to a key for this configuration object.

Parameters

string $key: (optional) A string that maps to a key within the configuration data. For instance in the following configuration array:

[
    'foo' => [
        'bar' => 'baz',
    ],
];

A key of 'foo.bar' would map to the string 'baz'. However, a key of 'foo' would map to the ['bar' => 'baz']. If not supplied TRUE will be returned if there are any overrides at all for this configuration object.

Return value

bool TRUE if there are any overrides for the key, otherwise FALSE.

File

core/lib/Drupal/Core/Config/Config.php, line 318

Class

Config
Defines the default configuration object.

Namespace

Drupal\Core\Config

Code

public function hasOverrides($key = '') {
    if (empty($key)) {
        return !(empty($this->moduleOverrides) && empty($this->settingsOverrides));
    }
    else {
        $parts = explode('.', $key);
        $override_exists = FALSE;
        if (isset($this->moduleOverrides) && is_array($this->moduleOverrides)) {
            $override_exists = NestedArray::keyExists($this->moduleOverrides, $parts);
        }
        if (!$override_exists && isset($this->settingsOverrides) && is_array($this->settingsOverrides)) {
            $override_exists = NestedArray::keyExists($this->settingsOverrides, $parts);
        }
        return $override_exists;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal