function hook_node_operations
7.x node.api.php | hook_node_operations() |
6.x core.php | hook_node_operations() |
Add mass node operations.
This hook enables modules to inject custom operations into the mass operations dropdown found at admin/content/node, by associating a callback function with the operation, which is called when the form is submitted. The callback function receives one initial argument, which is an array of the checked nodes.
Return value
An array of operations. Each operation is an associative array that may contain the following key-value pairs:
- "label": Required. The label for the operation, displayed in the dropdown menu.
- "callback": Required. The function to call for the operation.
- "callback arguments": Optional. An array of additional arguments to pass to the callback function.
Related topics
1 function implements hook_node_operations()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- node_node_operations in drupal-6.x/
modules/ node/ node.admin.inc - Implementation of hook_node_operations().
2 invocations of hook_node_operations()
- node_admin_nodes in drupal-6.x/
modules/ node/ node.admin.inc - Form builder: Builds the node administration overview.
- node_admin_nodes_submit in drupal-6.x/
modules/ node/ node.admin.inc - Process node_admin_nodes form submissions.
File
- documentation-6.x/
developer/ hooks/ core.php, line 1585 - These are the hooks that are invoked by the Drupal core.
Code
function hook_node_operations() {
$operations = array(
'approve' => array(
'label' => t('Approve the selected posts'),
'callback' => 'node_operations_approve',
),
'promote' => array(
'label' => t('Promote the selected posts'),
'callback' => 'node_operations_promote',
),
'sticky' => array(
'label' => t('Make the selected posts sticky'),
'callback' => 'node_operations_sticky',
),
'demote' => array(
'label' => t('Demote the selected posts'),
'callback' => 'node_operations_demote',
),
'unpublish' => array(
'label' => t('Unpublish the selected posts'),
'callback' => 'node_operations_unpublish',
),
'delete' => array(
'label' => t('Delete the selected posts'),
),
);
return $operations;
}