You are here

trait DiscoveryCachedTrait in Plug 7

Hierarchy

1 file declares its use of DiscoveryCachedTrait
DefaultPluginManager.php in lib/Drupal/Core/Plugin/DefaultPluginManager.php
Contains \Drupal\Core\Plugin\DefaultPluginManager.

File

lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php, line 10
Contains \Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait.

Namespace

Drupal\Component\Plugin\Discovery
View source
trait DiscoveryCachedTrait {
  use DiscoveryTrait;

  /**
   * Cached definitions array.
   *
   * @var array
   */
  protected $definitions;

  /**
   * {@inheritdoc}
   */
  public function getDefinition($plugin_id, $exception_on_invalid = TRUE) {

    // Fetch definitions if they're not loaded yet.
    if (!isset($this->definitions)) {
      $this
        ->getDefinitions();
    }
    return $this
      ->doGetDefinition($this->definitions, $plugin_id, $exception_on_invalid);
  }

}

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::getDefinitions abstract public function 8
DiscoveryTrait::hasDefinition public function