class ConfigActionsChange in Config Actions 8
Plugin for changing data.
Plugin annotation
@ConfigActionsPlugin(
id = "change",
description = @Translation("Change data."),
options = {
"path" = { },
"value" = NULL,
"value_path" = { },
"current_value" = NULL,
},
replace_in = { "path", "value", "value_path", "current_value", "dest", "load" },
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\config_actions\ConfigActionsPluginBase implements ConfigActionsPluginInterface, ContainerFactoryPluginInterface
- class \Drupal\config_actions\Plugin\ConfigActions\ConfigActionsChange uses ConfigActionsValidateTrait
- class \Drupal\config_actions\ConfigActionsPluginBase implements ConfigActionsPluginInterface, ContainerFactoryPluginInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of ConfigActionsChange
File
- src/
Plugin/ ConfigActions/ ConfigActionsChange.php, line 24
Namespace
Drupal\config_actions\Plugin\ConfigActionsView source
class ConfigActionsChange extends ConfigActionsPluginBase {
use ConfigActionsValidateTrait;
/**
* Config data to be added.
* @var mixed
*/
protected $value;
/**
* Main transform to perform the change
*/
public function transform(array $source) {
if (isset($this->value)) {
$this
->validatePath($source);
$source = ConfigActionsTransform::change($source, $this->path, $this->value);
}
return $source;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigActionsChange:: |
protected | property | Config data to be added. | |
ConfigActionsChange:: |
public | function |
Main transform to perform the change Overrides ConfigActionsPluginBase:: |
|
ConfigActionsPluginBase:: |
protected | property | ||
ConfigActionsPluginBase:: |
protected | property | The list of allowed option keys. Taken from the plugin annotation. key/value array where the key is the option name and the value is the default. | |
ConfigActionsPluginBase:: |
protected | property | If FALSE, do not run action when service has autoExecute enabled. | |
ConfigActionsPluginBase:: |
protected | property | Optional Base path for source and dest. | |
ConfigActionsPluginBase:: |
protected | property | Optional config corresponding to id. | |
ConfigActionsPluginBase:: |
protected | property | Optional destination id of config item. | |
ConfigActionsPluginBase:: |
protected | property | Plugin type of the destination. | |
ConfigActionsPluginBase:: |
protected | property | List to keep track of what options have had string replacement. | |
ConfigActionsPluginBase:: |
protected | property | The id of the action. | |
ConfigActionsPluginBase:: |
protected | property | The pattern of the action key (id). | |
ConfigActionsPluginBase:: |
protected | property | Optional Module name for source templates. | 1 |
ConfigActionsPluginBase:: |
protected | property | Optional data used by the plugins. Taken from the plugin annotation. | |
ConfigActionsPluginBase:: |
protected | property |
The id name of the plugin instance. Overrides PluginBase:: |
|
ConfigActionsPluginBase:: |
protected | property | List of string replacement variables and values. | |
ConfigActionsPluginBase:: |
protected | property | List of options that allow string replacement. | |
ConfigActionsPluginBase:: |
protected | property | Source data to manipulate. | |
ConfigActionsPluginBase:: |
protected | property | Plugin type of the source. | |
ConfigActionsPluginBase:: |
protected | property | Overrides the Source with an existing config/templates template defined in some installed module. | 1 |
ConfigActionsPluginBase:: |
protected | function | Add additional allowed options. Used by Traits in plugins to add global options. | |
ConfigActionsPluginBase:: |
public static | function |
Create a plugin instance from the container Overrides ContainerFactoryPluginInterface:: |
|
ConfigActionsPluginBase:: |
public | function |
Execute the action for this plugin. Overrides ConfigActionsPluginInterface:: |
1 |
ConfigActionsPluginBase:: |
protected | function | Return a specific property from the plugin specific data. | |
ConfigActionsPluginBase:: |
public | function | Return a current option value. | |
ConfigActionsPluginBase:: |
protected | function | Initialize a plugin. | |
ConfigActionsPluginBase:: |
protected | function | Return True if array is Sequential | |
ConfigActionsPluginBase:: |
public | function | Parse any property references in the options. | |
ConfigActionsPluginBase:: |
protected | function | Perform string replacement on the $data and return the result. | |
ConfigActionsPluginBase:: |
public | function | Process an Options array to set various internal variable defaults. | |
ConfigActionsPluginBase:: |
public | function |
Constructs a new ConfigActionsPlugin object. Overrides PluginBase:: |
|
ConfigActionsValidateTrait:: |
protected | property | Current data at path to be validated. | |
ConfigActionsValidateTrait:: |
protected | property | Path to config being altered | |
ConfigActionsValidateTrait:: |
protected | property | Optional path to the $current_value to be used instead of $path. | |
ConfigActionsValidateTrait:: |
protected | function | Perform validation of the path. Call this from the plugin transform or execute method. Throws exception if validation fails. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
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:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
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. |