class DevelDumperPluginManager

Same name in other branches
  1. 4.x src/DevelDumperPluginManager.php \Drupal\devel\DevelDumperPluginManager
  2. 5.x src/DevelDumperPluginManager.php \Drupal\devel\DevelDumperPluginManager

Plugin type manager for Devel Dumper plugins.

Hierarchy

Expanded class hierarchy of DevelDumperPluginManager

See also

\Drupal\devel\Annotation\DevelDumper

\Drupal\devel\DevelDumperInterface

\Drupal\devel\DevelDumperBase

plugin_api

1 string reference to 'DevelDumperPluginManager'
devel.services.yml in ./devel.services.yml
devel.services.yml
1 service uses DevelDumperPluginManager
plugin.manager.devel_dumper in ./devel.services.yml
Drupal\devel\DevelDumperPluginManager

File

src/DevelDumperPluginManager.php, line 18

Namespace

Drupal\devel
View source
class DevelDumperPluginManager extends DefaultPluginManager implements DevelDumperPluginManagerInterface {
    
    /**
     * Constructs a DevelDumperPluginManager object.
     *
     * @param \Traversable $namespaces
     *   An object that implements \Traversable which contains the root paths
     *   keyed by the corresponding namespace to look for plugin implementations.
     * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
     *   Cache backend instance to use.
     * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
     *   The module handler to invoke the alter hook with.
     */
    public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
        parent::__construct('Plugin/Devel/Dumper', $namespaces, $module_handler, DevelDumperInterface::class, DevelDumper::class);
        $this->setCacheBackend($cache_backend, 'devel_dumper_plugins');
        $this->alterInfo('devel_dumper_info');
    }
    
    /**
     * {@inheritdoc}
     */
    public function processDefinition(&$definition, $plugin_id) {
        parent::processDefinition($definition, $plugin_id);
        $definition['supported'] = (bool) call_user_func([
            $definition['class'],
            'checkRequirements',
        ]);
    }
    
    /**
     * {@inheritdoc}
     */
    public function isPluginSupported($plugin_id) {
        $definition = $this->getDefinition($plugin_id, FALSE);
        return $definition && $definition['supported'];
    }
    
    /**
     * {@inheritdoc}
     */
    public function createInstance($plugin_id, array $configuration = []) {
        if (!$this->isPluginSupported($plugin_id)) {
            $plugin_id = $this->getFallbackPluginId($plugin_id);
        }
        return parent::createInstance($plugin_id, $configuration);
    }
    
    /**
     * {@inheritdoc}
     */
    public function getFallbackPluginId($plugin_id, array $configuration = []) {
        return 'default';
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
DevelDumperPluginManager::createInstance public function
DevelDumperPluginManager::getFallbackPluginId public function
DevelDumperPluginManager::isPluginSupported public function Checks if plugin has a definition and is supported. Overrides DevelDumperPluginManagerInterface::isPluginSupported
DevelDumperPluginManager::processDefinition public function
DevelDumperPluginManager::__construct public function Constructs a DevelDumperPluginManager object.