Skip to content

Instantly share code, notes, and snippets.

@lpeabody
Created January 8, 2019 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lpeabody/a28026d31131e5c6ff83372baef0932b to your computer and use it in GitHub Desktop.
Save lpeabody/a28026d31131e5c6ff83372baef0932b to your computer and use it in GitHub Desktop.
Collection ignore filter
<?php
namespace Drupal\edelman_custom\Plugin\ConfigFilter;
use Drupal\config_filter\Plugin\ConfigFilterBase;
/**
* Provides a filter that skips language collections.
*
* @ConfigFilter(
* id = "collection_ignore",
* label = "Config Collection Ignore",
* storages = {"config.storage.sync", "config.storage.active"},
* weight = 101
* )
*/
class CollectionIgnore extends ConfigFilterBase {
/**
* {@inheritdoc}
*/
public function filterGetAllCollectionNames(array $collections) {
$collections = array_filter($collections, function ($collection) {
if (fnmatch('language.*', $collection)) {
return FALSE;
}
return TRUE;
});
return $collections;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment