class PluginHelper

Same name in other branches
  1. 9 core/lib/Drupal/Component/Plugin/PluginHelper.php \Drupal\Component\Plugin\PluginHelper
  2. 10 core/lib/Drupal/Component/Plugin/PluginHelper.php \Drupal\Component\Plugin\PluginHelper
  3. 11.x core/lib/Drupal/Component/Plugin/PluginHelper.php \Drupal\Component\Plugin\PluginHelper

A helper class to determine if a plugin is configurable.

Because configurable plugins in Drupal 8 might implement either the deprecated ConfigurablePluginInterface or the new ConfigurableInterface, this static method is provided so that a calling class can determine if a plugin is configurable without checking it against a deprecated interface. In Drupal 9, this check should be reduced to checking for ConfigurableInterface only and be deprecated in favor of calling classes checking against the interface directly.

Hierarchy

Expanded class hierarchy of PluginHelper

4 files declare their use of PluginHelper
Action.php in core/modules/system/src/Entity/Action.php
ContextAwarePluginBase.php in core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
DefaultLazyPluginCollection.php in core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php
DefaultSingleLazyPluginCollection.php in core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php

File

core/lib/Drupal/Component/Plugin/PluginHelper.php, line 16

Namespace

Drupal\Component\Plugin
View source
class PluginHelper {
    
    /**
     * Determines if a plugin is configurable.
     *
     * @param mixed $plugin
     *   The plugin to check.
     *
     * @return bool
     *   A boolean indicating whether the plugin is configurable.
     */
    public static function isConfigurable($plugin) {
        return $plugin instanceof ConfigurableInterface || $plugin instanceof ConfigurablePluginInterface;
    }

}

Members

Title Sort descending Modifiers Object type Summary
PluginHelper::isConfigurable public static function Determines if a plugin is configurable.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.