abstract class PluginBase in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal/Component/Plugin/PluginBase.php \Drupal\Component\Plugin\PluginBase
Base class for plugins wishing to support metadata inspection.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
Expanded class hierarchy of PluginBase
14 files declare their use of PluginBase
- Plugin1A.php in modules/
providers/ service_container_annotation_discovery/ tests/ modules/ service_container_annotation_discovery_test/ src/ Plugin/ Plugin1/ Plugin1A/ Plugin1A.php - Plugin1B.php in modules/
providers/ service_container_annotation_discovery/ tests/ modules/ service_container_annotation_discovery_test/ src/ Plugin/ Plugin1/ Plugin1B/ Plugin1B.php - Plugin2A.php in modules/
providers/ service_container_annotation_discovery/ tests/ modules/ service_container_annotation_discovery_test/ src/ Plugin/ Plugin2/ Plugin2A/ Plugin2A.php - Plugin2B.php in modules/
providers/ service_container_annotation_discovery/ tests/ modules/ service_container_annotation_discovery_test/ src/ Plugin/ Plugin2/ Plugin2B/ Plugin2B.php - Plugin3A.php in modules/
providers/ service_container_annotation_discovery/ tests/ modules/ service_container_annotation_discovery_test/ src/ Plugin/ Plugin3/ Plugin3A/ Plugin3A.php
File
- lib/
Drupal/ Component/ Plugin/ PluginBase.php, line 12 - Contains \Drupal\Component\Plugin\PluginBase.
Namespace
Drupal\Component\PluginView source
abstract class PluginBase implements PluginInspectionInterface, DerivativeInspectionInterface {
/**
* A string which is used to separate base plugin IDs from the derivative ID.
*/
const DERIVATIVE_SEPARATOR = ':';
/**
* The plugin_id.
*
* @var string
*/
protected $pluginId;
/**
* The plugin implementation definition.
*
* @var array
*/
protected $pluginDefinition;
/**
* Configuration information passed into the plugin.
*
* When using an interface like
* \Drupal\Component\Plugin\ConfigurablePluginInterface, this is where the
* configuration should be stored.
*
* Plugin configuration is optional, so plugin implementations must provide
* their own setters and getters.
*
* @var array
*/
protected $configuration;
/**
* Constructs a Drupal\Component\Plugin\PluginBase object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
$this->configuration = $configuration;
$this->pluginId = $plugin_id;
$this->pluginDefinition = $plugin_definition;
}
/**
* {@inheritdoc}
*/
public function getPluginId() {
return $this->pluginId;
}
/**
* {@inheritdoc}
*/
public function getBaseId() {
$plugin_id = $this
->getPluginId();
if (strpos($plugin_id, static::DERIVATIVE_SEPARATOR)) {
list($plugin_id) = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2);
}
return $plugin_id;
}
/**
* {@inheritdoc}
*/
public function getDerivativeId() {
$plugin_id = $this
->getPluginId();
$derivative_id = NULL;
if (strpos($plugin_id, static::DERIVATIVE_SEPARATOR)) {
list(, $derivative_id) = explode(static::DERIVATIVE_SEPARATOR, $plugin_id, 2);
}
return $derivative_id;
}
/**
* {@inheritdoc}
*/
public function getPluginDefinition() {
return $this->pluginDefinition;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Constructs a Drupal\Component\Plugin\PluginBase object. | 5 |