Views formatter for pdf media thumbnail does not work on non default display

Created on 23 October 2023, 8 months ago
Updated 24 November 2023, 7 months ago

Problem/Motivation

The pdf media thumbnail formatter settings form does not work properly when used on the non default view. It will not load the saved settings and show them correctly. However changing them and saving will set the right values but those will not be loaded next time the field settings are opened.

Steps to reproduce

Install and activate pdf media thumbnail

  1. create a view that displays content of type media
  2. add a second display to that view
  3. configure the non default display to show media entity fields, specifically the thumbnail
  4. configure the thumbnail field to be rendered using the pdf media thumbnail formatter
  5. modify the field pdf media thumbnail related settings and save
  6. open that same field once more. the previously saved settings will not be visible

Proposed resolution

The issue happens in the _get_setting_values function in the media_pdf_thumbnail.module file.
replace the fourth active line in this function as follows (previous one is commented)

function _get_setting_values(FormStateInterface $form_state) {
  /** @var \Drupal\views\Entity\View $view */
  $view = $form_state->getStorage()['view'];
  $display = $view->getExecutable()->getDisplay();
  $inputValues = $form_state->getUserInput();
  // $defaultDisplayOptions = $display->default_display->options['fields']['thumbnail__target_id']['settings'];
  $defaultDisplayOptions = $display->options['fields']['thumbnail__target_id']['settings'];

Remaining tasks

review if still applicable to rc3 and patch

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

6.0

Component

Code

Created by

πŸ‡±πŸ‡§Lebanon vitch

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

Comments & Activities

Production build 0.69.0 2024