class EventBasedDefaultPluginResolver in Plugin 8.2
Provides an event-based default plugin resolver.
Hierarchy
- class \Drupal\plugin\DefaultPluginResolver\EventBasedDefaultPluginResolver implements DefaultPluginResolverInterface
Expanded class hierarchy of EventBasedDefaultPluginResolver
1 file declares its use of EventBasedDefaultPluginResolver
- EventBasedDefaultPluginResolverTest.php in tests/
src/ Unit/ DefaultPluginResolver/ EventBasedDefaultPluginResolverTest.php
1 string reference to 'EventBasedDefaultPluginResolver'
1 service uses EventBasedDefaultPluginResolver
File
- src/
DefaultPluginResolver/ EventBasedDefaultPluginResolver.php, line 13
Namespace
Drupal\plugin\DefaultPluginResolverView source
class EventBasedDefaultPluginResolver implements DefaultPluginResolverInterface {
/**
* The event dispatcher.
*
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
*/
protected $eventDispatcher;
/**
* Creates a new instance.
*
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
*/
public function __construct(EventDispatcherInterface $event_dispatcher) {
$this->eventDispatcher = $event_dispatcher;
}
/**
* {@inheritdoc}
*/
public function createDefaultPluginInstance(PluginTypeInterface $plugin_type) {
$event = new ResolveDefaultPlugin($plugin_type);
$this->eventDispatcher
->dispatch(PluginEvents::RESOLVE_DEFAULT_PLUGIN, $event);
return $event
->getDefaultPluginInstance();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EventBasedDefaultPluginResolver:: |
protected | property | The event dispatcher. | |
EventBasedDefaultPluginResolver:: |
public | function |
Creates a default plugin instance of a given plugin type. Overrides DefaultPluginResolverInterface:: |
|
EventBasedDefaultPluginResolver:: |
public | function | Creates a new instance. |