class ConfigSubscriber in CMS Content Sync 2.1.x
Same name and namespace in other branches
- 2.0.x src/EventSubscriber/ConfigSubscriber.php \Drupal\cms_content_sync\EventSubscriber\ConfigSubscriber
A subscriber triggering a config when certain configuration changes.
Hierarchy
- class \Drupal\cms_content_sync\EventSubscriber\ConfigSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ConfigSubscriber
File
- src/
EventSubscriber/ ConfigSubscriber.php, line 16
Namespace
Drupal\cms_content_sync\EventSubscriberView source
class ConfigSubscriber implements EventSubscriberInterface {
/**
* The config Factory.
*
* @var \Drupal\Core\Config\ConfigFactory
*/
protected $config_factory;
/**
* The Core EntityTypeManager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
*/
protected $entity_type_manager;
/**
* @param \Drupal\Core\Config\ConfigFactory $config_factory
* The config factory
*/
public function __construct(ConfigFactory $config_factory, EntityTypeManagerInterface $entity_type_manager) {
$this->config_factory = $config_factory;
$this->entity_type_manager = $entity_type_manager;
}
/**
* Delete unsed remote flows after config deletion.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The Event to process
*/
public function deleteUnusedFlows(ConfigCrudEvent $event) {
if (str_contains($event
->getConfig()
->getName(), 'cms_content_sync.flow')) {
Flow::resetFlowCache();
SyncCoreFlowExport::deleteUnusedFlows();
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ConfigEvents::DELETE][] = [
'deleteUnusedFlows',
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigSubscriber:: |
protected | property | The config Factory. | |
ConfigSubscriber:: |
protected | property | The Core EntityTypeManager. | |
ConfigSubscriber:: |
public | function | Delete unsed remote flows after config deletion. | |
ConfigSubscriber:: |
public static | function | ||
ConfigSubscriber:: |
public | function |