-
-
Save lpeabody/ae172a1da52a311b4581a49eccc69c83 to your computer and use it in GitHub Desktop.
Replaced export command using filtered config storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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