You are here

function print_menu in Printer, email and PDF versions 5

Same name and namespace in other branches
  1. 5.4 print.module \print_menu()
  2. 5.2 print.module \print_menu()
  3. 5.3 print.module \print_menu()
  4. 6 print.module \print_menu()
  5. 7.2 print.module \print_menu()
  6. 7 print.module \print_menu()
  7. 5.x print.module \print_menu()

Implementation of hook_menu().

File

./print.module, line 15
Display printer friendly versions of nodes (except books)

Code

function print_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'print',
      'title' => t('Printer friendly'),
      'callback' => 'print_controller',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/print',
      'title' => t('Printer friendly'),
      'description' => t('Adds a printer-friendly version link to node pages.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'print_main_settings',
      ),
    );
  }
  else {
    $nid = arg(1);
    if (is_numeric($nid)) {
      $items[] = array(
        'path' => 'print/' . $nid,
        'title' => t('Printer friendly'),
        'callback' => 'print_node_controller',
        'callback arguments' => array(
          $nid,
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}