You are here

StaticDiscovery.php in Service Container 7

Same filename and directory in other branches
  1. 7.2 lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php

File

lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Component\Plugin\Discovery\StaticDiscovery.
 */
namespace Drupal\Component\Plugin\Discovery;


/**
 * A discovery mechanism that allows plugin definitions to be manually
 * registered rather than actively discovered.
 */
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]);
  }

}

Classes

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