public function EventBasedDefaultPluginResolver::createDefaultPluginInstance in Plugin 8.2
Creates a default plugin instance of a given plugin type.
Parameters
\Drupal\plugin\PluginType\PluginTypeInterface:
Return value
\Drupal\Component\Plugin\PluginInspectionInterface|null A plugin instance or NULL of no default could be created.
Overrides DefaultPluginResolverInterface::createDefaultPluginInstance
File
- src/
DefaultPluginResolver/ EventBasedDefaultPluginResolver.php, line 34
Class
- EventBasedDefaultPluginResolver
- Provides an event-based default plugin resolver.
Namespace
Drupal\plugin\DefaultPluginResolverCode
public function createDefaultPluginInstance(PluginTypeInterface $plugin_type) {
$event = new ResolveDefaultPlugin($plugin_type);
$this->eventDispatcher
->dispatch(PluginEvents::RESOLVE_DEFAULT_PLUGIN, $event);
return $event
->getDefaultPluginInstance();
}