You are here

class ResolveDefaultPlugin in Plugin 8.2

Provides an event that is dispatched when the a default plugin instance is resolved.

Hierarchy

Expanded class hierarchy of ResolveDefaultPlugin

See also

\Drupal\plugin\Event\PluginEvents::RESOLVE_DEFAULT_PLUGIN

3 files declare their use of ResolveDefaultPlugin
EventBasedDefaultPluginResolver.php in src/DefaultPluginResolver/EventBasedDefaultPluginResolver.php
EventBasedDefaultPluginResolverTest.php in tests/src/Unit/DefaultPluginResolver/EventBasedDefaultPluginResolverTest.php
ResolveDefaultPluginTest.php in tests/src/Unit/Event/ResolveDefaultPluginTest.php

File

src/Event/ResolveDefaultPlugin.php, line 15

Namespace

Drupal\plugin\Event
View source
class ResolveDefaultPlugin extends Event {

  /**
   * The plugin type.
   *
   * @var \Drupal\plugin\PluginType\PluginTypeInterface
   */
  protected $pluginType;

  /**
   * The default plugin instance.
   *
   * @var \Drupal\Component\Plugin\PluginInspectionInterface|null
   *   The default plugin instance or NULL if there is no default instance.
   */
  protected $defaultPluginInstance;

  /**-
   * Constructs a new instance.
   *
   * @param \Drupal\plugin\PluginType\PluginTypeInterface $plugin_type
   */
  public function __construct(PluginTypeInterface $plugin_type) {
    $this->pluginType = $plugin_type;
  }

  /**
   * Gets the plugin type for which a default plugin instance is resolved.
   *
   * @return \Drupal\plugin\PluginType\PluginTypeInterface
   */
  public function getPluginType() {
    return $this->pluginType;
  }

  /**
   * Gets the default plugin instance.
   *
   * @return \Drupal\Component\Plugin\PluginInspectionInterface|null
   *   The default plugin instance or NULL if there is no default instance.
   */
  public function getDefaultPluginInstance() {
    return $this->defaultPluginInstance;
  }

  /**
   * Sets an the default plugin instance.
   *
   * @param \Drupal\Component\Plugin\PluginInspectionInterface $default_plugin_instance
   *
   * @return $this
   */
  public function setDefaultPluginInstance(PluginInspectionInterface $default_plugin_instance) {
    $this->defaultPluginInstance = $default_plugin_instance;
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ResolveDefaultPlugin::$defaultPluginInstance protected property The default plugin instance.
ResolveDefaultPlugin::$pluginType protected property The plugin type.
ResolveDefaultPlugin::getDefaultPluginInstance public function Gets the default plugin instance.
ResolveDefaultPlugin::getPluginType public function Gets the plugin type for which a default plugin instance is resolved.
ResolveDefaultPlugin::setDefaultPluginInstance public function Sets an the default plugin instance.
ResolveDefaultPlugin::__construct public function