class ConfigActionsDefault in Config Actions 8
Default Plugin for changing, adding, deleting data.
Plugin annotation
@ConfigActionsPlugin(
id = "default",
description = @Translation("Change, Add, Delete data."),
options = {
"path" = { },
"value" = NULL,
"change" = NULL,
"add" = NULL,
"delete" = NULL,
"value_path" = { },
"current_value" = NULL,
},
replace_in = { "path", "value", "change", "add", "delete", "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\ConfigActionsDefault uses ConfigActionsValidateTrait
- class \Drupal\config_actions\ConfigActionsPluginBase implements ConfigActionsPluginInterface, ContainerFactoryPluginInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of ConfigActionsDefault
File
- src/
Plugin/ ConfigActions/ ConfigActionsDefault.php, line 27
Namespace
Drupal\config_actions\Plugin\ConfigActionsView source
class ConfigActionsDefault extends ConfigActionsPluginBase {
use ConfigActionsValidateTrait;
/**
* Config data to be changed.
* Deprecated in favor of $changed.
*
* @var mixed
*/
protected $value;
/**
* Config data to be changed.
* @var mixed
*/
protected $change;
/**
* Config data to be added.
* @var mixed
*/
protected $add;
/**
* Config data to be deleted.
* @var mixed
*/
protected $delete;
/**
* Main transform to perform the change
*/
public function transform(array $source) {
$this
->validatePath($source);
if (isset($this->value)) {
$source = ConfigActionsTransform::change($source, $this->path, $this->value);
}
if (isset($this->change)) {
$source = ConfigActionsTransform::change($source, $this->path, $this->change);
}
if (isset($this->add)) {
$source = ConfigActionsTransform::add($source, $this->path, $this->add, TRUE);
}
if (isset($this->delete)) {
$source = ConfigActionsTransform::delete($source, $this->path, $this->delete, TRUE);
}
return $source;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigActionsDefault:: |
protected | property | Config data to be added. | |
ConfigActionsDefault:: |
protected | property | Config data to be changed. | |
ConfigActionsDefault:: |
protected | property | Config data to be deleted. | |
ConfigActionsDefault:: |
protected | property | Config data to be changed. Deprecated in favor of $changed. | |
ConfigActionsDefault:: |
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. |