function print_block in Printer, email and PDF versions 5.3
Same name and namespace in other branches
- 5.4 print.module \print_block()
- 6 print.module \print_block()
- 5.x print.module \print_block()
Implementation of hook_block().
File
- ./print.module, line 103 
- Displays Printer-friendly versions of Drupal pages.
Code
function print_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $block[$delta]['info'] = t('Printer, e-mail and PDF versions');
      return $block;
      break;
    case 'configure':
      return '';
    case 'save':
      return;
    case 'view':
      $nid = preg_replace('!^node/!', '', $_GET['q']);
      if (is_numeric($nid)) {
        $node = node_load(array(
          'nid' => $nid,
        ));
      }
      else {
        $node = NULL;
      }
      $funcs = get_defined_functions();
      $block['content'] = '';
      foreach ($funcs['user'] as $func) {
        if (preg_match('!^print.*?_insert_link$!', $func)) {
          $link = $func(NULL, $node);
          if (!empty($link)) {
            $block['content'] .= $link . '<br />';
          }
        }
      }
      return $block;
      break;
  }
}