You are here

public function HighContrastConfigOverride::getCacheableMetadata in High contrast 8

@todo Check the right $name. See https://www.drupal.org/node/2866194

Overrides ConfigFactoryOverrideInterface::getCacheableMetadata

File

src/HighContrastConfigOverride.php, line 75

Class

HighContrastConfigOverride
Configuration override class for high contrast.

Namespace

Drupal\high_contrast

Code

public function getCacheableMetadata($name) {
  $metadata = new CacheableMetadata();
  if ($name === 'system.theme.global') {
    $config = $this->configFactory
      ->get('high_contrast.settings');

    // Cache depends on enabled state and configuration.
    $metadata
      ->addCacheContexts([
      'high_contrast',
    ]);
    $metadata
      ->addCacheableDependency($config);
  }
  return $metadata;
}