ConfigActionsDefault.php in Config Actions 8
File
src/Plugin/ConfigActions/ConfigActionsDefault.php
View source
<?php
namespace Drupal\config_actions\Plugin\ConfigActions;
use Drupal\config_actions\ConfigActionsPluginBase;
use Drupal\config_actions\ConfigActionsTransform;
use Drupal\config_actions\ConfigActionsValidateTrait;
class ConfigActionsDefault extends ConfigActionsPluginBase {
use ConfigActionsValidateTrait;
protected $value;
protected $change;
protected $add;
protected $delete;
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;
}
}