You are here

function rules_link_load_condition_set in Rules Link 7.2

Same name and namespace in other branches
  1. 7 rules_link.module \rules_link_load_condition_set()

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

Parameters

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

3 calls to rules_link_load_condition_set()
rules_link_component_form in ./rules_link.admin.inc
Form function for the rules link components.
rules_link_form in ./rules_link.admin.inc
Generates the rules link editing form.
rules_link_form_submit in ./rules_link.admin.inc
Form API submit callback for the type form.

File

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

Code

function rules_link_load_condition_set($rules_link) {
  $condition_set = rules_config_load(rules_link_get_condition_set_name($rules_link));
  if ($condition_set != FALSE) {
    return $condition_set;
  }
  else {
    $conditions = rules_and(array(
      $rules_link->entity_type => array(
        'type' => $rules_link->entity_type,
        'label' => $rules_link->entity_type,
      ),
    ));
    $conditions->label = 'Rules link: ' . $rules_link->label . ' condition';
    $conditions
      ->save(rules_link_get_condition_set_name($rules_link), 'rules_link');
    return $conditions;
  }
}