You are here

function webform_validation_rule_load in Webform Validation 7

Same name and namespace in other branches
  1. 6 webform_validation.module \webform_validation_rule_load()

Load a validation rule.

Parameters

int $ruleid: The rule ID.

Return value

array|false The rule or FALSE if no rule exists.

1 call to webform_validation_rule_load()
webform_validation_get_rule in ./webform_validation.rules.inc
Get a rule entry.

File

./webform_validation.module, line 70

Code

function webform_validation_rule_load($ruleid) {
  $result = db_query("SELECT ruleid, rulename, nid, validator, data, error_message, negate, weight FROM {webform_validation_rule} WHERE ruleid = :ruleid", array(
    ':ruleid' => $ruleid,
  ), array(
    'fetch' => PDO::FETCH_ASSOC,
  ));
  $rule = $result
    ->fetchAssoc();
  if (!$rule) {
    return FALSE;
  }
  $rule['components'] = webform_validation_get_rule_components($ruleid, $rule['nid']);
  $rule['negate'] = (bool) $rule['negate'];
  return $rule;
}