You are here

function clone_menu in Node clone 5

Same name and namespace in other branches
  1. 5.2 clone.module \clone_menu()
  2. 6 clone.module \clone_menu()
  3. 7 clone.module \clone_menu()

Implementation of hook_menu().

File

./clone.module, line 25

Code

function clone_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/clone',
      'title' => t('Clone module'),
      'description' => t('Allows users to clone (copy then edit) an existing node.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'clone_settings',
      'access' => user_access('administer site configuration'),
    );
  }
  else {
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      $node = node_load(arg(1));
      if ($node->nid) {
        $items[] = array(
          'path' => 'node/' . $node->nid . '/clone',
          'title' => t('Clone'),
          'callback' => 'clone_node_check',
          'access' => clone_access_cloning($node),
          'type' => MENU_LOCAL_TASK,
          'weight' => 5,
        );
      }
    }
  }
  return $items;
}