You are here

function rules_admin_rule_proxy::save_rule in Rules 6

Saves a the rule in the database

1 call to rules_admin_rule_proxy::save_rule()
rules_admin_rule_proxy::save_changes in rules_admin/rules_admin.rule_proxy.inc
Saves the changes in the rule and clears the cache if necessary.

File

rules_admin/rules_admin.rule_proxy.inc, line 141
Contains the rules proxy class

Class

rules_admin_rule_proxy
This is a smally proxy for the real rule. It provides some useful operations for the admin UI. It builds a small index for the elements of a rule, so that they can be easily identified and modified.

Code

function save_rule() {
  $rule = $this
    ->get_rule();
  if (!isset($rule['#status']) || $rule['#status'] == 'default') {
    $rule['#status'] = 'altered';
  }

  // Sort conditions and actions.
  rules_sort_elements($rule['#conditions']);
  rules_sort_elements($rule['#actions']);
  rules_item_save('rules', $this
    ->get_rule_name(), $rule);
  if (isset($this->_new_name)) {
    rules_item_change_name('rules', $this
      ->get_rule_name(), $this->_new_name);
    $this->_rule_name = $this->_new_name;
    unset($this->_new_name);
  }
}