You are here

public function CacheabilityMetadataConfigOverride::loadOverrides in Drupal 8

Same name and namespace 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()

Returns config overrides.

Parameters

array $names: A list of configuration names that are being loaded.

Return value

array An array keyed by configuration name of override data. Override data contains a nested array structure of overrides.

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;
}