class DefaultContentConfigSubscriber in Default Content for D8 2.0.x
Same name and namespace in other branches
- 8 src/Config/DefaultContentConfigSubscriber.php \Drupal\default_content\Config\DefaultContentConfigSubscriber
Reacts to configuration events for the Default Content module.
Hierarchy
- class \Drupal\default_content\Config\DefaultContentConfigSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of DefaultContentConfigSubscriber
1 string reference to 'DefaultContentConfigSubscriber'
1 service uses DefaultContentConfigSubscriber
File
- src/
Config/ DefaultContentConfigSubscriber.php, line 13
Namespace
Drupal\default_content\ConfigView source
class DefaultContentConfigSubscriber implements EventSubscriberInterface {
/**
* The default content importer.
*
* @var \Drupal\default_content\ImporterInterface
*/
protected $defaultContentImporter;
/**
* Constructs a DefaultContentConfigSubscriber object.
*
* @param \Drupal\default_content\ImporterInterface $default_content_importer
* The default content importer.
*/
public function __construct(ImporterInterface $default_content_importer) {
$this->defaultContentImporter = $default_content_importer;
}
/**
* Creates default content after config synchronization.
*
* @param \Drupal\Core\Config\ConfigImporterEvent $event
* The config importer event.
*/
public function onConfigImport(ConfigImporterEvent $event) {
$modules = $event
->getConfigImporter()
->getExtensionChangelist('module', 'install');
foreach ($modules as $module) {
$this->defaultContentImporter
->importContent($module);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
ConfigEvents::IMPORT => 'onConfigImport',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DefaultContentConfigSubscriber:: |
protected | property | The default content importer. | |
DefaultContentConfigSubscriber:: |
public static | function | ||
DefaultContentConfigSubscriber:: |
public | function | Creates default content after config synchronization. | |
DefaultContentConfigSubscriber:: |
public | function | Constructs a DefaultContentConfigSubscriber object. |