Project

General

Profile

Revision 65389548

Added by Assos Assos over 4 years ago

Weekly update of contrib modules

View differences:

drupal7/sites/all/modules/webform_validation/webform_validation.rules.inc
18 18

  
19 19
/**
20 20
 * Get an array of rules assigned to a webform node.
21
 *
22
 * @param int $nid
23
 *   The node ID.
24
 *
25
 * @return array
26
 *   The rules for a node keyed by their rule ID.
27
 *
28
 * @see webform_validation_get_node_rules_assoc()
21 29
 */
22 30
function webform_validation_get_node_rules($nid) {
23 31
  $rules = array();
......
30 38
  return $rules;
31 39
}
32 40

  
41
/**
42
 * Get an array of rules assigned to a webform node keyed by their rulename.
43
 *
44
 * @param int $nid
45
 *   The node ID.
46
 *
47
 * @return array
48
 *   The rules for a node keyed by their rulename.
49
 *
50
 * @see webform_validation_get_node_rules()
51
 */
52
function webform_validation_get_node_rules_assoc($nid) {
53
  $assoc_rules = array();
54
  if ($rules = webform_validation_get_node_rules($nid)) {
55
    foreach ($rules as $rule) {
56
      $components = array();
57
      foreach ($rule['components'] as $cid => $component) {
58
        $components[$cid] = $cid;
59
      }
60
      ksort($components);
61
      $rule['components'] = $components;
62
      $assoc_rules[$rule['rulename']] = $rule;
63
    }
64
    ksort($assoc_rules);
65
  }
66
  return $assoc_rules;
67
}
68

  
33 69
/**
34 70
 * Get an array of components linked to a rule.
35 71
 */

Also available in: Unified diff