diff --git a/clone.module b/clone.module index c898135..565d2e9 100644 --- a/clone.module +++ b/clone.module @@ -25,6 +25,33 @@ function clone_perm() { } /** +* Implementation of hook_node_operations(). +*/ +function clone_node_operations() { + $operations = array(); + if (user_access('clone node')) { + $operations['node_clone'] = array( + 'label' => 'Clone node', + 'callback' => 'clone_node_save_array', + ); + } + return $operations; +} + +/** +* Wrapper for clone_node_save that takes an array of node ids argument +* @param array $nids +*/ +function clone_node_save_array($nids = array()) { + if (!empty($nids)) { + include_once(drupal_get_path('module', 'clone') . '/clone.pages.inc'); + foreach ($nids as $nid) { + clone_node_save($nid); + } + } +} + +/** * Implementation of hook_menu(). */ function clone_menu() {