1. 8.3.x core/lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php StaticDiscovery
  2. 8.0.x core/lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php StaticDiscovery
  3. 8.1.x core/lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php StaticDiscovery
  4. 8.2.x core/lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php StaticDiscovery
  5. 8.4.x core/lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php StaticDiscovery

A discovery mechanism that allows plugin definitions to be manually registered rather than actively discovered.

Hierarchy

Expanded class hierarchy of StaticDiscovery

5 files declare their use of StaticDiscovery
DefaultsTestPluginManager.php in core/modules/system/tests/modules/plugin_test/src/Plugin/DefaultsTestPluginManager.php
MockBlockManager.php in core/modules/system/tests/modules/plugin_test/src/Plugin/MockBlockManager.php
StaticDiscoveryTest.php in core/tests/Drupal/KernelTests/Core/Plugin/Discovery/StaticDiscoveryTest.php
TestPluginManager.php in core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php
TestPluginManager.php in core/modules/system/tests/modules/plugin_test/src/Plugin/TestPluginManager.php

File

core/lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php, line 9

Namespace

Drupal\Component\Plugin\Discovery
View source
class StaticDiscovery implements DiscoveryInterface {

  use DiscoveryCachedTrait;

  /**
   * {@inheritdoc}
   */
  public function getDefinitions() {
    if (!$this->definitions) {
      $this->definitions = array();
    }
    return $this->definitions;
  }

  /**
   * Sets a plugin definition.
   */
  public function setDefinition($plugin, $definition) {
    $this->definitions[$plugin] = $definition;
  }

  /**
   * Deletes a plugin definition.
   */
  public function deleteDefinition($plugin) {
    unset($this->definitions[$plugin]);
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
DiscoveryCachedTrait::$definitions protected property Cached definitions array. 1
DiscoveryCachedTrait::getDefinition public function Gets a specific plugin definition. Overrides DiscoveryTrait::getDefinition 3
DiscoveryTrait::doGetDefinition protected function Gets a specific plugin definition. Overrides DiscoveryTrait::doGetDefinition 1
DiscoveryTrait::hasDefinition public function Indicates if a specific plugin definition exists. Overrides DiscoveryTrait::hasDefinition 1
StaticDiscovery::deleteDefinition public function Deletes a plugin definition.
StaticDiscovery::getDefinitions public function Gets the definition of all plugins for this type. Overrides DiscoveryTrait::getDefinitions 1
StaticDiscovery::setDefinition public function Sets a plugin definition.