1 node.module node_delete_action(Node $node, &$context)

Queues a node for deletion.


Node $node: A node entity.

$context: Contextual information about the triggered action.

Related topics


core/modules/node/node.module, line 3565
The core module that allows content to be submitted to the site.


function node_delete_action(Node $node, &$context) {
  // Save the list of nodes to be deleted in the session. Append to the existing
  // list if within the last minute, otherwise start a new list of nodes.
  $last_action_time = 0;
  if (isset($_SESSION['node_delete_action'])) {
    $last_action_time = $_SESSION['node_delete_action']['timestamp'];
  if (REQUEST_TIME - $last_action_time > 60) {
    $_SESSION['node_delete_action'] = array(
      'timestamp' => REQUEST_TIME,
      'nids' => array(),

  $_SESSION['node_delete_action']['nids'][] = $node->nid;
  $context['redirect'] = 'admin/content/node/delete';