You are here

function print_epub_generate_path in Printer, email and PDF versions 7.2

Gennerate a EPUB for a given Drupal path.

Parameters

string $path: path of the page to convert to EPUB.

array $query: (Optional) array of key/value pairs as used in the url() function for the query.

int $cid: (Optional) comment ID of the comment to render.

string $epub_filename: (Optional) filename of the generated EPUB.

string $view_mode: (Optional) view mode to be used when rendering the content.

Return value

string|null generated EPUB page, or NULL in case of error

See also

print_epub_controller()

1 call to print_epub_generate_path()
print_epub_controller in print_epub/print_epub.pages.inc
Generate a EPUB version of the printer-friendly page.

File

print_epub/print_epub.pages.inc, line 108

Code

function print_epub_generate_path($path, $query = NULL, $cid = NULL, $epub_filename = NULL, $view_mode = PRINT_VIEW_MODE) {
  $link = print_epub_print_link();
  $node = print_controller($path, $link['format'], $cid, $view_mode);
  if ($node) {
    $html = theme('print', array(
      'node' => $node,
      'query' => $query,
      'expand_css' => TRUE,
      'format' => $link['format'],
    ));
    $meta = array(
      'node' => $node,
      'url' => url(drupal_get_path_alias(empty($node->nid) ? $node->path : "node/{$node->nid}"), array(
        'absolute' => TRUE,
      )),
    );
    if (isset($node->name)) {
      $meta['name'] = $node->name;
    }
    if (isset($node->title)) {
      $meta['title'] = $node->title;
    }
    return print_epub_generate_html($html, $meta, $epub_filename);
  }
  else {
    return NULL;
  }
}