You are here

public function CacheabilityMetadataConfigOverride::loadOverrides in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/config/tests/config_override_integration_test/src/CacheabilityMetadataConfigOverride.php \Drupal\config_override_integration_test\CacheabilityMetadataConfigOverride::loadOverrides()
  2. 9 core/modules/config/tests/config_override_integration_test/src/CacheabilityMetadataConfigOverride.php \Drupal\config_override_integration_test\CacheabilityMetadataConfigOverride::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;
}