I'm trying to validate a set of nodes before saving them to the database:
foreach ($nodes_to_save as $node) {
if (! (node_validate($node, $form))) {
form_set_error('', t('Node %title did not validate. No nodes were saved.', array('%title' => $node->title)));
$success = FALSE;
break;
}
}
The documentation for node_validate says that it will call form_set_error()
to indicate why the node hasn't validated. However, this does not happen with the above code. All I get is the error I set manually. What am I doing wrong?