You are here

public function StatusOverride::setSplitOverride in Configuration Split 2.0.x

Set a config split state locally.

Parameters

string $name: The name of the config split.

bool|null $active: The state, null to reset.

File

src/Config/StatusOverride.php, line 52

Class

StatusOverride
A config override for config split based on the drupal state.

Namespace

Drupal\config_split\Config

Code

public function setSplitOverride(string $name, bool $active = NULL) {
  $name = self::fixName($name);
  $overrides = $this->state
    ->get('config_split_override_state', []);
  if ($active === NULL) {
    unset($overrides[$name]);
  }
  else {
    $overrides[$name] = $active;
  }
  $this->state
    ->set('config_split_override_state', $overrides);
  $this->cacheInvalidator
    ->invalidateTags($this
    ->getCacheableMetadata('config_split.config_split.' . $name)
    ->getCacheTags());
}