public function PirateDayCacheabilityMetadataConfigOverride::loadOverrides in Drupal 8
Same name and namespace in other branches
- 9 core/modules/config/tests/config_override_test/src/PirateDayCacheabilityMetadataConfigOverride.php \Drupal\config_override_test\PirateDayCacheabilityMetadataConfigOverride::loadOverrides()
- 10 core/modules/config/tests/config_override_test/src/PirateDayCacheabilityMetadataConfigOverride.php \Drupal\config_override_test\PirateDayCacheabilityMetadataConfigOverride::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_test/ src/ PirateDayCacheabilityMetadataConfigOverride.php, line 18
Class
- PirateDayCacheabilityMetadataConfigOverride
- Test implementation of a config override that provides cacheability metadata.
Namespace
Drupal\config_override_testCode
public function loadOverrides($names) {
$overrides = [];
// Override the theme and the 'call_to_action' block on Pirate Day.
if (PirateDayCacheContext::isPirateDay()) {
if (in_array('system.theme', $names)) {
$overrides = $overrides + [
'system.theme' => [
'default' => 'pirate',
],
];
}
if (in_array('block.block.call_to_action', $names)) {
$overrides = $overrides + [
'block.block.call_to_action' => [
'settings' => [
'label' => 'Draw yer cutlasses!',
],
],
];
}
}
return $overrides;
}