function webform_validation_get_node_rules in Webform Validation 7
Same name and namespace in other branches
- 6 webform_validation.rules.inc \webform_validation_get_node_rules()
Get an array of rules assigned to a webform node.
Parameters
int $nid: The node ID.
Return value
array The rules for a node keyed by their rule ID.
See also
webform_validation_get_node_rules_assoc()
8 calls to webform_validation_get_node_rules()
- webform_validation_form_webform_client_form_alter in ./
webform_validation.module - Implements hook_form_BASE_FORM_ID_alter().
- webform_validation_get_node_rules_assoc in ./
webform_validation.rules.inc - Get an array of rules assigned to a webform node keyed by their rulename.
- webform_validation_get_webform_rules in ./
webform_validation.admin.inc - Get the list of rules associated with the webform.
- webform_validation_manage in ./
webform_validation.admin.inc - Menu callback function.
- webform_validation_node_clone in ./
webform_validation.module - Adds support for node_clone module.
File
- ./
webform_validation.rules.inc, line 29 - Provides API and management functions for the webform validation rules.
Code
function webform_validation_get_node_rules($nid) {
$rules = array();
$result = db_query("SELECT ruleid, rulename, nid, validator, data, error_message, negate, weight FROM {webform_validation_rule} WHERE nid = :nid ORDER BY weight ASC, ruleid DESC", array(
':nid' => $nid,
), array(
'fetch' => PDO::FETCH_ASSOC,
));
foreach ($result as $rule) {
$rule['components'] = webform_validation_get_rule_components($rule['ruleid'], $rule['nid']);
$rule['negate'] = (bool) $rule['negate'];
$rules[$rule['ruleid']] = $rule;
}
return $rules;
}