public static function ProblemsStorage::delete_node_problems in Node Accessibility 8
Deletes the node report data from the database.
This is primarly used to remove data for a node that no longer has any validation failures.
Parameters
int $nid: The node id of the node associated with the given reports.
int|null $vid: (optional) The node revision id of the node associated with the given reports.
Return value
bool TRUE on success, FALSE otherwise.
3 calls to ProblemsStorage::delete_node_problems()
- node_accessibility_node_delete in ./
node_accessibility.module - Implements hook_ENTITY_TYPE_delete().
- PerformValidation::nodes in src/
PerformValidation.php - Performs validation on the given nodes and stores the results.
- PerformValidation::node_revisions in src/
PerformValidation.php - Performs validation on the given nodes and stores the results.
File
- src/
ProblemsStorage.php, line 122
Class
- ProblemsStorage
- Class DatabaseStorage.
Namespace
Drupal\node_accessibilityCode
public static function delete_node_problems($nid, $vid = NULL) {
if (!is_numeric($nid)) {
return FALSE;
}
if (!is_null($vid) && !is_numeric($vid)) {
return FALSE;
}
$query = \Drupal::database()
->delete('node_accessibility_problems');
$query
->condition('nid', $nid);
if (!is_null($vid)) {
$query
->condition('vid', $vid);
}
try {
return $query
->execute();
} catch (Exception $e) {
\Drupal::logger('node_accessibility')
->error("Failed to delete node problems with nid=@nid and vid=@vid.", [
'@nid' => $nid,
'@vid' => $vid,
]);
} catch (Error $e) {
\Drupal::logger('node_accessibility')
->error("Failed to delete node problems with nid=@nid and vid=@vid.", [
'@nid' => $nid,
'@vid' => $vid,
]);
}
return FALSE;
}