function RulesState::saveChanges

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

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 185

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