1 node.actions.inc | node_delete_action(Node $node, &$context) |
Queues a node for deletion.
Parameters
Node $node: A node entity.
$context: Contextual information about the triggered action.
Related topics
File
- core/
modules/ node/ node.actions.inc, line 107 - Action callbacks for Node module.
Code
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';
}