You are here

function print_controller in Printer, email and PDF versions 5.2

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

Print module path catcher

1 string reference to 'print_controller'
print_menu in ./print.module
Implementation of hook_menu()

File

./print.module, line 333
Display printer-friendly versions of Drupal pages

Code

function print_controller() {

  // Remove the print/ prefix
  $args = substr($_GET['q'], strlen(PRINT_PATH) + 1);
  $cid = $_GET['comment'];
  $nid = $args;
  if (!is_numeric($nid)) {

    // Indirect call with print/alias
    // If there is a path alias with these arguments, generate a printer-friendly version for it
    $path = drupal_get_normal_path($args);
    $ret = preg_match("/^node\\/(.*)/i", $path, $matches);
    if ($ret == 1) {
      $nid = $matches[1];
    }
  }
  if (is_numeric($nid)) {
    print_generate_node($nid, $cid);
  }
  else {
    $ret = preg_match("/^book\\/export\\/html\\/(.*)/i", $args, $matches);
    if ($ret == 1) {

      // This is a book PF page link, handle trough the book handling functions
      print_generate_book($matches[1]);
    }
    else {

      // If no content node was found, handle the page printing with the 'printable' engine
      print_generate_path($args);
    }
  }
}