function node_accessibility_validate_action in Node Accessibility 7
Performs accessibility validation on a given node.
$param object $node A node object.
Return value
array|false An array containing the validation results or FALSE.
1 string reference to 'node_accessibility_validate_action'
- node_accessibility_validate_rules_action in ./
node_accessibility.rules.inc - Action: Perform accessibility validation on a node.
File
- ./
node_accessibility.module, line 1210 - Module file for the node accessibility project.
Code
function node_accessibility_validate_action($node) {
if (!is_object($node)) {
if (class_exists('cf_error')) {
cf_error::invalid_object('node');
}
return FALSE;
}
$results = node_accessibility_perform_validation(array(
$node,
));
$reports = array();
$node_type_settings = node_accessibility_load_node_type_settings();
$node_settings = $node_type_settings[$node->type];
if (isset($results[$node->nid][$node->vid]['report'])) {
$reports = $results[$node->nid][$node->vid]['report'];
$methods = quail_api_get_validation_methods(NULL);
$database = isset($methods[$node_settings['method']]['database']) ? $methods[$node_settings['method']]['database'] : FALSE;
unset($results);
if ($database && !empty($reports)) {
$no_failures = TRUE;
foreach ($reports as $severity => $severity_results) {
if (isset($severity_results['total']) && $severity_results['total'] > 0) {
$no_failures = FALSE;
break;
}
}
if ($no_failures) {
node_accessibility_delete_node_problems($node->nid, $node->vid);
}
else {
node_accessibility_save_node_problems($node->nid, $node->vid, $reports);
}
}
}
watchdog('actions', "Accessibility validating node %nid:%vid.", array(
'%nid' => $node->nid,
'%vid' => $node->vid,
));
return $reports;
}