You are here

function webform_validation_get_node_rules_assoc in Webform Validation 7

Get an array of rules assigned to a webform node keyed by their rulename.

Parameters

int $nid: The node ID.

Return value

array The rules for a node keyed by their rulename.

See also

webform_validation_get_node_rules()

2 calls to webform_validation_get_node_rules_assoc()
webform_validation_entity_uuid_save in ./webform_validation.module
Implements hook_entity_uuid_save().
webform_validation_uuid_node_features_export_render_alter in ./webform_validation.module
Implements hook_uuid_node_features_export_render_alter().

File

./webform_validation.rules.inc, line 51
Provides API and management functions for the webform validation rules.

Code

function webform_validation_get_node_rules_assoc($nid) {
  $assoc_rules = array();
  if ($rules = webform_validation_get_node_rules($nid)) {
    foreach ($rules as $rule) {
      $components = array();
      foreach ($rule['components'] as $cid => $component) {
        $components[$cid] = $cid;
      }
      ksort($components);
      $rule['components'] = $components;
      $assoc_rules[$rule['rulename']] = $rule;
    }
    ksort($assoc_rules);
  }
  return $assoc_rules;
}