You are here

function PageBreak::render in Views PDF 8

This method renders the page break. It uses the PDF class to add a page break.

Overrides StylePluginBase::render

File

src/Plugin/views/style/PageBreak.php, line 68
Contains \Drupal\views_pdf\Plugin\views\style\PageBreak.

Class

PageBreak
Class that holds the functionality for the page break in a PDF display.

Code

function render($values) {
  if (isset($this->view->pdf) && is_object($this->view->pdf)) {
    if ($this->options['last_row'] == TRUE && $this->countRecords + 1 >= $this->view->total_rows) {
      return '';
    }
    $this->countRecords++;
    if ($this->countRecords == $this->view->total_rows + 1) {
      $this->countRecords = 1;
    }
    $output = '';
    if ($this->countRecords % $this->options['every_nth'] == 0) {
      $output .= '<br pagebreak="true" />';
    }
    else {
      $output .= '';
    }
    return $output;
  }
}