class ConfigEventsSubscriber in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\tmgmt_smartling\EventSubscriber\ConfigEventsSubscriber
Class ConfigEventsSubscriber.
@package Drupal\tmgmt_smartling\EventSubscriber
Hierarchy
- class \Drupal\tmgmt_smartling\EventSubscriber\ConfigEventsSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ConfigEventsSubscriber
1 string reference to 'ConfigEventsSubscriber'
1 service uses ConfigEventsSubscriber
File
- src/
EventSubscriber/ ConfigEventsSubscriber.php, line 15
Namespace
Drupal\tmgmt_smartling\EventSubscriberView source
class ConfigEventsSubscriber implements EventSubscriberInterface {
/**
* @var CacheTagsInvalidator
*/
private $cacheInvalidator;
/**
* ConfigEventsSubscriber constructor.
*
* @param \Drupal\Core\Cache\CacheTagsInvalidator $cacheInvalidator
*/
public function __construct(CacheTagsInvalidator $cacheInvalidator) {
$this->cacheInvalidator = $cacheInvalidator;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ConfigEvents::SAVE][] = [
'onSavingConfig',
];
return $events;
}
/**
* Subscriber Callback for the event.
* @param ConfigCrudEvent $event
*/
public function onSavingConfig(ConfigCrudEvent $event) {
$config_data = $event
->getConfig()
->get();
if (!empty($config_data["plugin"]) && $config_data["plugin"] == "smartling" && !empty($config_data["settings"]["project_id"])) {
$this->cacheInvalidator
->invalidateTags([
"tmgmt_smartling:firebase_config:{$config_data["settings"]["project_id"]}",
]);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigEventsSubscriber:: |
private | property | ||
ConfigEventsSubscriber:: |
public static | function | ||
ConfigEventsSubscriber:: |
public | function | Subscriber Callback for the event. | |
ConfigEventsSubscriber:: |
public | function | ConfigEventsSubscriber constructor. |