Fields marked "exclude from display" do not produce tokens for use in subsequent fields

Created on 8 March 2024, 10 months ago
Updated 26 March 2024, 9 months ago

Problem/Motivation

Fields that are marked as hidden (exclude from display) in view do not produce tokens for use in subsequent fields. The "if" at line 48 of /src/Plugin/views/row/PDFFields.php appears to be the cause. If it's removed the tokens reappear and no other bad things seem to happen.

Steps to reproduce

Create a Views PDF display with fields that are excluded for display. Then try to use their tokens in a subsequent field. No dice.

Proposed resolution

(lines 48-69 of /views_pdf/src/Plugin/views/row/PDFFields.php)

foreach ($this->view->field as $id => $field) {
//if (empty($field->options['exclude'])) {
$options = $this->options['formats'][$id] ?? [];

switch ($this->view->getStyle()->pluginId) {
case 'pdf_unformatted':
// Register the row for header & footer on the current page before writing
// each field. This is necessary in case the fields for one record span
// multiple pages, or there is a page break. Otherwise there can be pages
// with missing headers and footers.
$this->pdf->setHeaderFooter($row, $this->options, $this->view);

$this->pdf->drawContent($row, $options, $this->view, $id);

break;
case 'pdf_grid':
$options['grid'] = $this->options['grid'];
$this->pdf->drawContent($row, $options, $this->view, $id);
$this->options['grid']['new_cell'] = FALSE;
break;
}
//}
}

Remaining tasks

Merge request enroute.

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States rclemings

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024