You are here

class ConfigActionsDelete in Config Actions 8

Plugin for deleting data.

Plugin annotation


@ConfigActionsPlugin(
  id = "delete",
  description = @Translation("Delete data."),
  options = {
    "path" = { },
    "value_path" = { },
    "current_value" = NULL,
    "prune" = FALSE,
  },
  replace_in = { "path", "value_path", "current_value" },
)

Hierarchy

Expanded class hierarchy of ConfigActionsDelete

File

src/Plugin/ConfigActions/ConfigActionsDelete.php, line 24

Namespace

Drupal\config_actions\Plugin\ConfigActions
View source
class ConfigActionsDelete extends ConfigActionsPluginBase {
  use ConfigActionsValidateTrait;

  /**
   * True if key should be unset (pruned) rather than just cleared.
   * @var bool
   */
  protected $prune;

  /**
   * Main transform to perform the deletion
   */
  public function transform(array $source) {
    $this
      ->validatePath($source);
    $result = ConfigActionsTransform::delete($source, $this->path, $this->prune);

    // If entire result is pruned, return an empty array to cause config to
    // be deleted.
    return !empty($result) ? $result : [];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigActionsDelete::$prune protected property True if key should be unset (pruned) rather than just cleared.
ConfigActionsDelete::transform public function Main transform to perform the deletion Overrides ConfigActionsPluginBase::transform
ConfigActionsPluginBase::$actionService protected property
ConfigActionsPluginBase::$allowedOptions 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::$auto protected property If FALSE, do not run action when service has autoExecute enabled.
ConfigActionsPluginBase::$base protected property Optional Base path for source and dest.
ConfigActionsPluginBase::$config protected property Optional config corresponding to id.
ConfigActionsPluginBase::$dest protected property Optional destination id of config item.
ConfigActionsPluginBase::$dest_type protected property Plugin type of the destination.
ConfigActionsPluginBase::$did_replace protected property List to keep track of what options have had string replacement.
ConfigActionsPluginBase::$id protected property The id of the action.
ConfigActionsPluginBase::$key protected property The pattern of the action key (id).
ConfigActionsPluginBase::$module protected property Optional Module name for source templates. 1
ConfigActionsPluginBase::$pluginData protected property Optional data used by the plugins. Taken from the plugin annotation.
ConfigActionsPluginBase::$pluginId protected property The id name of the plugin instance. Overrides PluginBase::$pluginId
ConfigActionsPluginBase::$replace protected property List of string replacement variables and values.
ConfigActionsPluginBase::$replace_in protected property List of options that allow string replacement.
ConfigActionsPluginBase::$source protected property Source data to manipulate.
ConfigActionsPluginBase::$source_type protected property Plugin type of the source.
ConfigActionsPluginBase::$template protected property Overrides the Source with an existing config/templates template defined in some installed module. 1
ConfigActionsPluginBase::addAllowed protected function Add additional allowed options. Used by Traits in plugins to add global options.
ConfigActionsPluginBase::create public static function Create a plugin instance from the container Overrides ContainerFactoryPluginInterface::create
ConfigActionsPluginBase::execute public function Execute the action for this plugin. Overrides ConfigActionsPluginInterface::execute 1
ConfigActionsPluginBase::getData protected function Return a specific property from the plugin specific data.
ConfigActionsPluginBase::getOption public function Return a current option value.
ConfigActionsPluginBase::initPlugin protected function Initialize a plugin.
ConfigActionsPluginBase::isSequential protected function Return True if array is Sequential
ConfigActionsPluginBase::parseOptions public function Parse any property references in the options.
ConfigActionsPluginBase::replaceData protected function Perform string replacement on the $data and return the result.
ConfigActionsPluginBase::setOptions public function Process an Options array to set various internal variable defaults.
ConfigActionsPluginBase::__construct public function Constructs a new ConfigActionsPlugin object. Overrides PluginBase::__construct
ConfigActionsValidateTrait::$current_value protected property Current data at path to be validated.
ConfigActionsValidateTrait::$path protected property Path to config being altered
ConfigActionsValidateTrait::$value_path protected property Optional path to the $current_value to be used instead of $path.
ConfigActionsValidateTrait::validatePath protected function Perform validation of the path. Call this from the plugin transform or execute method. Throws exception if validation fails.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.