Skip to content

Instantly share code, notes, and snippets.

@prashantdsala
Last active November 29, 2023 07:06
Show Gist options
  • Save prashantdsala/e156626d0a4832584e7cefce671c8684 to your computer and use it in GitHub Desktop.
Save prashantdsala/e156626d0a4832584e7cefce671c8684 to your computer and use it in GitHub Desktop.
<?php
// This file will reside in modules/custom/YOURMODULE/src/Config
namespace Drupal\custom_event\Config;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Config\ConfigFactoryOverrideInterface;
use Drupal\Core\Config\StorageInterface;
/**
* Example configuration override.
*/
class ConfigExampleOverrides implements ConfigFactoryOverrideInterface {
/**
* {@inheritdoc}
*/
public function loadOverrides($names) {
$overrides = [];
if (in_array('config_split.config_split.development', $names)) {
$overrides['config_split.config_split.development'] = ['status' => TRUE];
}
return $overrides;
}
/**
* {@inheritdoc}
*/
public function getCacheSuffix() {
return 'ConfigExampleOverrider';
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($name) {
return new CacheableMetadata();
}
/**
* {@inheritdoc}
*/
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
return NULL;
}
}
?>
services:
config_example.overrider:
class: Drupal\custom_event\Config\ConfigExampleOverrides
tags:
- {name: config.factory.override, priority: 5}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment