You are here

public function RulesState::saveChanges in Rules 7.2

Apply permanent changes provided the wrapper's data type is savable.

Parameters

$selector: The data selector of the wrapper to save or just a variable name.

$wrapper:

bool $immediate: Pass FALSE to postpone saving to later on. Else it's immediately saved.

File

includes/rules.state.inc, line 181
Contains the state and data related stuff.

Class

RulesState
The rules evaluation state.

Code

public function saveChanges($selector, $wrapper, $immediate = FALSE) {
  $info = $wrapper
    ->info();
  if (empty($info['skip save']) && $this
    ->isSavable($wrapper)) {
    $this
      ->save($selector, $wrapper, $immediate);
  }
  elseif (empty($info['skip save']) && isset($info['parent']) && !$wrapper instanceof EntityDrupalWrapper) {

    // Cut of the last part of the selector.
    $selector = implode(':', explode(':', $selector, -1));
    $this
      ->saveChanges($selector, $info['parent'], $immediate);
  }
  return $this;
}