You are here

public function ConfigActionsSourceBase::save in Config Actions 8

Save data to the source.

Parameters

mixed $data:

Return value

bool TRUE if the data was saved.

Overrides ConfigActionsSourceInterface::save

File

src/ConfigActionsSourceBase.php, line 132

Class

ConfigActionsSourceBase
Base class for config_actions plugins.

Namespace

Drupal\config_actions

Code

public function save($data) {
  if (!empty($this->sourceId)) {
    if ($this
      ->getMerge() && !empty($data)) {
      $existing = $this
        ->doLoad();
      if (!empty($existing)) {
        $data = NestedArray::mergeDeepArray([
          $existing,
          $data,
        ], TRUE);
      }
    }
    $this
      ->setData($data, FALSE);
    return $this
      ->doSave($data);
  }
  else {
    return FALSE;
  }
}