hook_node_operations

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

developer/hooks/core.php, строка 1260

Версии
5 – 6
hook_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.

Возвращаемое значение

Массив операций. Каждая операция представляет собой ассоциативный массив, который может содержать следующие пары ключ-значение:

  • 'label': Обязательно. Название операции, отображается в выпадающем меню.
  • 'callback': Обязательно. Функция вызываемая для оперции.
  • 'callback arguments': Необязательно. Массив дополнительных аргументов для коллбэк-функции.

Связанные темы

▾ 2 функции вызывают hook_node_operations()

node_admin_nodes in modules/node/node.admin.inc
Form builder: Builds the node administration overview.
node_admin_nodes_submit in modules/node/node.admin.inc
Process node_admin_nodes form submissions.

Код

<?php
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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему