function CacheabilityMetadataConfigOverride::loadOverrides

Same name in other branches
  1. 9 core/modules/config/tests/config_override_integration_test/src/CacheabilityMetadataConfigOverride.php \Drupal\config_override_integration_test\CacheabilityMetadataConfigOverride::loadOverrides()
  2. 10 core/modules/config/tests/config_override_integration_test/src/CacheabilityMetadataConfigOverride.php \Drupal\config_override_integration_test\CacheabilityMetadataConfigOverride::loadOverrides()
  3. 11.x core/modules/config/tests/config_override_integration_test/src/CacheabilityMetadataConfigOverride.php \Drupal\config_override_integration_test\CacheabilityMetadataConfigOverride::loadOverrides()

Overrides ConfigFactoryOverrideInterface::loadOverrides

File

core/modules/config/tests/config_override_integration_test/src/CacheabilityMetadataConfigOverride.php, line 17

Class

CacheabilityMetadataConfigOverride
Test implementation of a config override that provides cacheability metadata.

Namespace

Drupal\config_override_integration_test

Code

public function loadOverrides($names) {
    $overrides = [];
    // Override the test block depending on the state set in the test.
    $state = \Drupal::state()->get('config_override_integration_test.enabled', FALSE);
    if (in_array('block.block.config_override_test', $names) && $state !== FALSE) {
        $overrides = $overrides + [
            'block.block.config_override_test' => [
                'settings' => [
                    'label' => 'Overridden block label',
                ],
            ],
        ];
    }
    return $overrides;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.