You are here

public function ConfigSplitIgnoreFilter::filterListAll in Configuration Split Ignore 8

Overrides IgnoreFilter::filterListAll

File

src/Plugin/ConfigFilter/ConfigSplitIgnoreFilter.php, line 184

Class

ConfigSplitIgnoreFilter
Provides a ignore filter that allows to delete the configuration entities.

Namespace

Drupal\config_split_ignore\Plugin\ConfigFilter

Code

public function filterListAll($prefix, array $data) {
  foreach ($data as $key => $config_name) {

    // If the name is a deleted config, treat it as not existing.
    if (in_array(static::DELETION_PREFIX . $config_name, $this->configuration['ignored'], TRUE)) {
      unset($data[$key]);
    }
  }
  if (!empty($this
    ->getFilteredStorage()
    ->getCollectionName())) {

    // In collections, treat config as existing
    // if it is ignored and exists in the active storage.
    $active_names = $this->active
      ->listAll($prefix);
    $data = array_unique(array_merge($data, array_filter($active_names, [
      $this,
      'matchConfigName',
    ])));
  }

  // Allow to delete the configuration if the split becomes inactive.
  return $data;
}