You are here

class StaticDiscovery in Plug 7

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

Hierarchy

Expanded class hierarchy of StaticDiscovery

File

lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php, line 14
Contains \Drupal\Component\Plugin\Discovery\StaticDiscovery.

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

Namesort descending Modifiers Type Description Overrides
DiscoveryCachedTrait::$definitions protected property Cached definitions array.
DiscoveryCachedTrait::getDefinition public function Overrides DiscoveryTrait::getDefinition 1
DiscoveryTrait::doGetDefinition protected function Gets a specific plugin definition.
DiscoveryTrait::hasDefinition public function
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.