Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

StaticDiscovery.php

Namespace

Drupal\Component\Plugin\Discovery

File

core/lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php

View source
<?php

namespace Drupal\Component\Plugin\Discovery;


/**
 * Allows plugin definitions to be manually registered.
 */
class StaticDiscovery implements DiscoveryInterface {
    use DiscoveryCachedTrait;
    
    /**
     * {@inheritdoc}
     */
    public function getDefinitions() {
        if (!$this->definitions) {
            $this->definitions = [];
        }
        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

Title Deprecated Summary
StaticDiscovery Allows plugin definitions to be manually registered.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal