ConfigRewriteInstallSubscriber.php in Configuration Rewrite 8.2
File
src/EventSubscriber/ConfigRewriteInstallSubscriber.php
View source
<?php
namespace Drupal\config_rewrite\EventSubscriber;
use Drupal\config_rewrite\ConfigRewriter;
use Drupal\Core\Extension\ModuleEvents;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ConfigRewriteInstallSubscriber implements EventSubscriberInterface {
protected $configRewriter;
public function __construct(ConfigRewriter $config_rewriter) {
$this->configRewriter = $config_rewriter;
}
static function getSubscribedEvents() {
$events[ModuleEvents::MODULE_INSTALLED][] = [
'module_install_config_rewrite',
];
return $events;
}
public function module_install_config_rewrite(Event $event) {
$this->configRewriter
->rewriteModuleConfig($event
->getModule());
}
}