Skip to content

Instantly share code, notes, and snippets.

@lpeabody
Created January 8, 2019 04:35
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/ae172a1da52a311b4581a49eccc69c83 to your computer and use it in GitHub Desktop.
Save lpeabody/ae172a1da52a311b4581a49eccc69c83 to your computer and use it in GitHub Desktop.
Replaced export command using filtered config storage
<?php
namespace Drupal\edelman_custom\Commands;
use Drupal\config_filter\ConfigFilterStorageFactory;
use Drush\Drupal\Commands\config\ConfigExportCommands;
/**
* Replace config:export Drush command.
*/
class EdelmanExportCommands extends ConfigExportCommands {
/**
* @var ConfigFilterStorageFactory
*/
protected $filterFactory;
public function getConfigStorage() {
return $this->filterFactory->getFilteredStorage(parent::getConfigStorage(), ['config.storage.active']);
}
/**
* {@inheritdoc}
*/
public function __construct(\Drupal\Core\Config\ConfigManagerInterface $configManager, \Drupal\Core\Config\StorageInterface $configStorage, \Drupal\Core\Config\StorageInterface $configStorageSync, ConfigFilterStorageFactory $filter_factory) {
parent::__construct($configManager, $configStorage, $configStorageSync);
$this->filterFactory = $filter_factory;
}
/**
* Replace config:export command.
*
* @hook replace-command config:export
*/
public function replaceExport($label = null, $options = ['add' => false, 'commit' => false, 'message' => self::REQ, 'destination' => self::OPT, 'diff' => false])
{
parent::export($label, $options);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment