You are here

public function ConfigFilterStorageFactory::getFilteredStorage in Config Filter 8

Same name and namespace in other branches
  1. 8.2 src/ConfigFilterStorageFactory.php \Drupal\config_filter\ConfigFilterStorageFactory::getFilteredStorage()

Get a decorated storage with filters applied.

Parameters

\Drupal\Core\Config\StorageInterface $storage: The storage to decorate.

string[] $storage_names: The names of the storage, so the correct filters can be applied.

string[] $excluded: The ids of filters to exclude.

Return value

\Drupal\config_filter\Config\FilteredStorageInterface The decorated storage with the filters applied.

2 calls to ConfigFilterStorageFactory::getFilteredStorage()
ConfigFilterStorageFactory::getSync in src/ConfigFilterStorageFactory.php
Get the sync storage Drupal uses.
ConfigFilterStorageFactory::getSyncWithoutExcluded in src/ConfigFilterStorageFactory.php
Get the sync storage Drupal uses and exclude some plugins.

File

src/ConfigFilterStorageFactory.php, line 83

Class

ConfigFilterStorageFactory
Class ConfigFilterFactory.

Namespace

Drupal\config_filter

Code

public function getFilteredStorage(StorageInterface $storage, array $storage_names, array $excluded = []) {
  $filters = [];
  foreach ($this->managers as $manager) {

    // Filters from managers that come first will not be overwritten by
    // filters from lower priority managers.
    $filters = $filters + $manager
      ->getFiltersForStorages($storage_names, $excluded);
  }
  return new FilteredStorage($storage, $filters);
}