class LibrariesConfigSubscriber in Libraries API 8.3
Reacts to configuration changes of the 'libraries.settings' configuration.
Hierarchy
- class \Drupal\libraries\Config\LibrariesConfigSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of LibrariesConfigSubscriber
1 string reference to 'LibrariesConfigSubscriber'
1 service uses LibrariesConfigSubscriber
File
- src/
Config/ LibrariesConfigSubscriber.php, line 13
Namespace
Drupal\libraries\ConfigView source
class LibrariesConfigSubscriber implements EventSubscriberInterface {
/**
* The service container.
*
* @var \Symfony\Component\DependencyInjection\ContainerInterface
*/
protected $container;
/**
* Constructs a Libraries API configuration subscriber.
*
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* The service container.
*/
public function __construct(ContainerInterface $container) {
$this->container = $container;
}
/**
* Unsets the definition discovery service when its configuration changes.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The configuration event.
*/
public function onConfigSave(ConfigCrudEvent $event) {
if ($event
->getConfig()
->getName() === 'libraries.settings' && $event
->isChanged('definition')) {
$this->container
->set('libraries.definition.discovery', NULL);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
ConfigEvents::SAVE => 'onConfigSave',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LibrariesConfigSubscriber:: |
protected | property | The service container. | |
LibrariesConfigSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
LibrariesConfigSubscriber:: |
public | function | Unsets the definition discovery service when its configuration changes. | |
LibrariesConfigSubscriber:: |
public | function | Constructs a Libraries API configuration subscriber. |