Problem/Motivation

The field is located in options[settings][photoswipe_reference_image_field], so its not the third party settings bug, like we have it in #3523410: Missing Photoswipe Views caption: Drupal core's third party settings formatter missing from Views UI.

Steps to reproduce

1. Set up a view with field output
2. Add a media (image) reference field
3. Configure the Photoswipe or Photoswipe Responsive formatter
=> Find the empty photoswipe_reference_image_field select

Technically the "Field formatter with inline settings" field selection from https://www.drupal.org/project/field_formatter/ is similar in its functionality.

This bug only exists in the views formatter, while the formatter in the entity display works fine!

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
firefox_FIUTzsMg2G.png63.38 KBthomas.frobieter

Issue fork photoswipe-3576722

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

thomas.frobieter created an issue. See original summary.

anybody’s picture

Mhm, this MIGHT be hard, because we don't know what the referenced entity is. The most simple fix might be to list all image fields maybe?
But doesn't feel really good. Maybe other modules already solved this? Or any better ideas? Maybe first compare it to the other formatters?

EDIT: Aren't we already USING the field here (selected in the step before?) I mean we're configuring the image field formatter, why ask for another field? Maybe this is *just* a silly bug?

thomas.frobieter’s picture

No, this is not a bug; it's the regular PSWP Media/Entity Reference formatter, 1:1. It's the formatter for the media reference field. The field you select is the file field (so, by default, field_media_image).

anybody’s picture

Issue summary: View changes

Added the following to the issue summary:
Technically the "Field formatter with inline settings" field selection from https://www.drupal.org/project/field_formatter/ is similar in its functionality.

This bug only exists in the views formatter, while the formatter in the entity display works fine!

anybody’s picture

Okay I think the reason might be that

$target_bundles = $this->fieldDefinition->getSetting('handler_settings')['target_bundles'];

returns NULL in the view.

anybody’s picture

Even more interesting: In Views

$this->fieldDefinition

is a
Drupal\Core\Field\BaseFieldDefinition
and does NOT contain any target_bundles

while the same code is
Drupal\field\Entity\FieldConfig
in the field display form!

anybody’s picture

Status: Active » Needs review

Luckily I found the missing pieces here: https://git.drupalcode.org/project/field_formatter/-/blob/3.x/src/Plugin...

Works as expected now. Views need special treatment! :)

anybody’s picture

Assigned: Unassigned » thomas.frobieter

@thomas.frobieter please review via tugboat

thomas.frobieter’s picture

Assigned: thomas.frobieter » Unassigned
Status: Needs review » Reviewed & tested by the community

Works perfectly fine now! thx!

thomas.frobieter’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • anybody committed a547f92f on 5.x
    feat: #3576722 photoswipe_reference_image_field select is empty in Views
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.