You are here

class PageNumber in Views PDF 8

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

Hierarchy

Expanded class hierarchy of PageNumber

1 string reference to 'PageNumber'
views_pdf_views_data in ./views_pdf.views.inc
Implements hook_views_data().

File

src/Plugin/views/style/PageNumber.php, line 16
Contains \Drupal\views_pdf\Plugin\views\style\PageNumber.

View source
class PageNumber extends views_handler_field {

  /**
   * This method  is used to query data. In our case we want that no data is queried.
   */
  function query() {

    // Override parent::query() and don't alter query.
    $this->field_alias = 'pdf_page_number_' . $this->position;
  }

  /**
   * This method adds a page number to the display, if it is a PDF display.
   *
   * Therefore the PDF class is used.
   */
  function render($values) {
    if (isset($this->view->pdf) && is_object($this->view->pdf)) {
      return $this->view->pdf
        ->getPage();
    }
    else {
      return '';
    }
  }

  /**
   * We don't want to use advanced rendering.
   */
  function allow_advanced_render() {
    return FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PageNumber::allow_advanced_render function We don't want to use advanced rendering.
PageNumber::query function This method is used to query data. In our case we want that no data is queried.
PageNumber::render function This method adds a page number to the display, if it is a PDF display.