Commit f0500b7d authored by bircher's avatar bircher

Revert "Issue #2925084 by tstoeckler: FilteredStorage::createCollection()...

Revert "Issue #2925084 by tstoeckler: FilteredStorage::createCollection() needs to set the correct source and filtered storages on filters"

This reverts commit 05855047.
parent 05855047
......@@ -202,23 +202,14 @@ class FilteredStorage implements FilteredStorageInterface {
*/
public function createCollection($collection) {
$filters = [];
foreach ($this->filters as $key => $filter) {
foreach ($this->filters as $filter) {
$filter = $filter->filterCreateCollection($collection);
if ($filter) {
$filters[$key] = $filter;
$filters[] = $filter;
}
}
$storage = $this->storage->createCollection($collection);
$filtered = new static($storage, $filters);
// Set the storage to all the filters.
foreach ($filters as $filter) {
$filter->setSourceStorage(new ReadOnlyStorage($storage));
$filter->setFilteredStorage($filtered);
}
return $filtered;
return new static($this->storage->createCollection($collection), $filters);
}
/**
......
......@@ -189,8 +189,7 @@ interface StorageFilterInterface {
*
* @return \Drupal\config_filter\Config\StorageFilterInterface|null
* Return a filter that should participate in the collection. This allows
* filters to act on different collections. Note that a new instance of the
* filter should be created rather than returning $this directly.
* filters to act on different collections.
*/
public function filterCreateCollection($collection);
......
......@@ -125,7 +125,7 @@ abstract class ConfigFilterBase extends PluginBase implements ConfigFilterInterf
* {@inheritdoc}
*/
public function filterCreateCollection($collection) {
return clone $this;
return $this;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment