You are here

function views_pdf_plugin_row_fields::render in Views PDF 7

Same name and namespace in other branches
  1. 6 views_pdf_plugin_row_fields.inc \views_pdf_plugin_row_fields::render()
  2. 7.3 views_pdf_plugin_row_fields.inc \views_pdf_plugin_row_fields::render()
  3. 7.2 plugins/views_pdf_plugin_row_fields.inc \views_pdf_plugin_row_fields::render()

Renders the rows.

Overrides views_plugin_row::render

File

./views_pdf_plugin_row_fields.inc, line 16
PDF row fields plugin provides the the fields plugin for unformatted style.

Class

views_pdf_plugin_row_fields
This class contains all the functionality of the field PDF style.

Code

function render($row) {
  $options = $this
    ->option_definition();

  // Header of a record.
  $path = $this->view->pdf
    ->getTemplatePath($this->options['leading_template']);
  $this->view->pdf
    ->addPdfDocument($path);

  // Set row page template.
  $path = $this->view->pdf
    ->getTemplatePath($this->options['template'], $row, $this->view);
  $this->view->pdf
    ->setDefaultPageTemplate($path, 'row', 'row');

  // Due of limitations of field renderer, we invoke them
  // here and not in the field render function.
  foreach ($this->view->field as $id => $field) {
    if (isset($this->options['formats'][$id])) {
      $options = $this->options['formats'][$id];
    }
    else {
      $options = array();
    }
    $this->view->pdf
      ->drawContent($row, $options, $this->view, $id);

    // Set or update header / footer options per row
    // this ensures that we write the last record for each page
    // in the cache.
    $this->view->pdf
      ->setHeaderFooter($row, $this->options, $this->view);
  }

  // Footer of a record.
  $path = $this->view->pdf
    ->getTemplatePath($this->options['succeed_template']);
  $this->view->pdf
    ->addPdfDocument($path);

  // Reset the row page number.
  $this->view->pdf
    ->resetRowPageNumber();
}