You are here

function rules_link_load_rules_set in Rules Link 7

Same name and namespace in other branches
  1. 7.2 rules_link.module \rules_link_load_rules_set()

Loads and returns the rules set to a link. If it doesn't exist, a new one will be created.

Parameters

$rules_link: The rules link to which the condition or rules set should be loaded.

3 calls to rules_link_load_rules_set()
rules_link_check_visibility in ./rules_link.module
rules_link_component_form in ./rules_link.admin.inc
Form function for the rules link components.
rules_link_form_submit in ./rules_link.admin.inc
Form API submit callback for the type form.

File

./rules_link.module, line 133
Rules Link - module file.

Code

function rules_link_load_rules_set($rules_link) {
  $rule_set = rules_config_load(rules_link_get_rules_set_name($rules_link));
  if ($rule_set != FALSE) {
    return $rule_set;
  }
  else {
    $rule_set = rules_rule_set(array(
      $rules_link->entity_type => array(
        'type' => $rules_link->entity_type,
        'label' => $rules_link->entity_type,
      ),
    ));
    $rule_set->label = 'Rules link: ' . $rules_link->label . ' rules set';
    $rule_set
      ->save(rules_link_get_rules_set_name($rules_link), 'rules_link');
    return $rule_set;
  }
}