class PageNumber in Views PDF 8
Class that holds the functionality for the page number in a PDF display.
Hierarchy
- class \PageNumber extends \views_handler_field
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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PageNumber:: |
function | We don't want to use advanced rendering. | ||
PageNumber:: |
function | This method is used to query data. In our case we want that no data is queried. | ||
PageNumber:: |
function | This method adds a page number to the display, if it is a PDF display. |