You are here

public function SplitFilterDeriver::getDerivativeDefinitions in Configuration Split 8

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/ConfigFilter/SplitFilterDeriver.php, line 58

Class

SplitFilterDeriver
Provides block plugin definitions for custom menus.

Namespace

Drupal\config_split\Plugin\ConfigFilter

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  foreach ($this->entityStorage
    ->loadMultiple() as $name => $entity) {
    $config_name = $entity
      ->getConfigDependencyName();
    $config = $this->configFactory
      ->get($config_name);
    $this->derivatives[$name] = $base_plugin_definition;
    $this->derivatives[$name]['label'] = $entity
      ->label();
    $this->derivatives[$name]['config_name'] = $config_name;

    // The weight and status can be overwritten in settings.php, however,
    // the cache has to ble cleared for changes in overrides to take effect.
    $this->derivatives[$name]['weight'] = $config
      ->get('weight');
    $this->derivatives[$name]['status'] = $config
      ->get('status');
    $this->derivatives[$name]['config_dependencies']['config'] = [
      $config_name,
    ];
  }
  return $this->derivatives;
}