You are here

public function ConfigActionsDefault::transform in Config Actions 8

Main transform to perform the change

Overrides ConfigActionsPluginBase::transform

File

src/Plugin/ConfigActions/ConfigActionsDefault.php, line 59

Class

ConfigActionsDefault
Default Plugin for changing, adding, deleting data.

Namespace

Drupal\config_actions\Plugin\ConfigActions

Code

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;
}