abstract class ExecutablePluginBase in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Executable/ExecutablePluginBase.php \Drupal\Core\Executable\ExecutablePluginBase
Provides the basic architecture for executable plugins.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Component\Plugin\ContextAwarePluginBase implements ContextAwarePluginInterface
- class \Drupal\Core\Plugin\ContextAwarePluginBase implements ContextAwarePluginInterface uses DependencySerializationTrait, StringTranslationTrait, TypedDataTrait
- class \Drupal\Core\Executable\ExecutablePluginBase implements ExecutableInterface
- class \Drupal\Core\Plugin\ContextAwarePluginBase implements ContextAwarePluginInterface uses DependencySerializationTrait, StringTranslationTrait, TypedDataTrait
- class \Drupal\Component\Plugin\ContextAwarePluginBase implements ContextAwarePluginInterface
Expanded class hierarchy of ExecutablePluginBase
1 file declares its use of ExecutablePluginBase
- ConditionPluginBase.php in core/
lib/ Drupal/ Core/ Condition/ ConditionPluginBase.php - Contains \Drupal\Core\Condition\ConditionPluginBase.
File
- core/
lib/ Drupal/ Core/ Executable/ ExecutablePluginBase.php, line 16 - Contains \Drupal\Core\Executable\ExecutablePluginBase.
Namespace
Drupal\Core\ExecutableView source
abstract class ExecutablePluginBase extends ContextAwarePluginBase implements ExecutableInterface {
/**
* Gets an array of definitions of available configuration options.
*
* @todo: This needs to go into an interface.
*
* @return array
* An array of typed data definitions describing available configuration
* options, keyed by option name.
*/
public function getConfigDefinitions() {
$definition = $this
->getPluginDefinition();
if (!empty($definition['configuration'])) {
return $definition['configuration'];
}
return array();
}
/**
* Gets the definition of a configuration option.
*
* @todo: This needs to go into an interface.
*
* @return array
* The typed data definition describing the configuration option, or FALSE
* if the option does not exist.
*/
public function getConfigDefinition($key) {
$definition = $this
->getPluginDefinition();
if (!empty($definition['configuration'][$key])) {
return $definition['configuration'][$key];
}
return FALSE;
}
/**
* Gets all configuration values.
*
* @todo: This needs to go into an interface.
*
* @return array
* The array of all configuration values, keyed by configuration option
* name.
*/
public function getConfig() {
return $this->configuration;
}
/**
* Sets the value of a particular configuration option.
*
* @param string $name
* The name of the configuration option to set.
* @param mixed $value
* The value to set.
*
* @todo This doesn't belong here. Move this into a new base class in
* https://www.drupal.org/node/1764380.
* @todo This does not set a value in \Drupal::config(), so the name is confusing.
*
* @return \Drupal\Core\Executable\ExecutablePluginBase.
* The executable object for chaining.
*/
public function setConfig($key, $value) {
if ($definition = $this
->getConfigDefinition($key)) {
$typed_data = \Drupal::typedDataManager()
->create($definition, $value);
if ($typed_data
->validate()
->count() > 0) {
throw new PluginException("The provided configuration value does not pass validation.");
}
}
$this->configuration[$key] = $value;
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContextAwarePluginBase:: |
protected | property | The data objects representing the context of this plugin. | |
ContextAwarePluginBase:: |
protected | function | Wraps the context handler. | |
ContextAwarePluginBase:: |
protected | function |
Overrides ContextAwarePluginBase:: |
|
ContextAwarePluginBase:: |
public | function | 9 | |
ContextAwarePluginBase:: |
public | function | 7 | |
ContextAwarePluginBase:: |
public | function | 4 | |
ContextAwarePluginBase:: |
public | function |
Overrides ContextAwarePluginBase:: |
|
ContextAwarePluginBase:: |
public | function |
Overrides ContextAwarePluginBase:: |
|
ContextAwarePluginBase:: |
public | function |
Overrides ContextAwarePluginBase:: |
|
ContextAwarePluginBase:: |
public | function |
Gets a mapping of the expected assignment names to their context names. Overrides ContextAwarePluginInterface:: |
|
ContextAwarePluginBase:: |
public | function |
Gets the defined contexts. Overrides ContextAwarePluginInterface:: |
|
ContextAwarePluginBase:: |
public | function |
Gets the value for a defined context. Overrides ContextAwarePluginInterface:: |
|
ContextAwarePluginBase:: |
public | function |
Gets the values for all defined contexts. Overrides ContextAwarePluginInterface:: |
|
ContextAwarePluginBase:: |
public | function |
Set a context on this plugin. Overrides ContextAwarePluginBase:: |
|
ContextAwarePluginBase:: |
public | function |
Sets a mapping of the expected assignment names to their context names. Overrides ContextAwarePluginInterface:: |
|
ContextAwarePluginBase:: |
public | function |
Sets the value for a defined context. Overrides ContextAwarePluginBase:: |
|
ContextAwarePluginBase:: |
public | function |
Validates the set values for the defined contexts. Overrides ContextAwarePluginInterface:: |
|
ContextAwarePluginBase:: |
public | function |
Overrides \Drupal\Component\Plugin\PluginBase::__construct(). Overrides PluginBase:: |
2 |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
ExecutableInterface:: |
public | function | Executes the plugin. | 25 |
ExecutablePluginBase:: |
public | function | Gets all configuration values. | |
ExecutablePluginBase:: |
public | function | Gets the definition of a configuration option. | |
ExecutablePluginBase:: |
public | function | Gets an array of definitions of available configuration options. | |
ExecutablePluginBase:: |
public | function | Sets the value of a particular configuration option. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 2 |
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:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
TypedDataTrait:: |
protected | property | The typed data manager used for creating the data types. | |
TypedDataTrait:: |
public | function | Gets the typed data manager. | 1 |
TypedDataTrait:: |
public | function | Sets the typed data manager. | 1 |