HTML picture object is replaced by img

Created on 11 October 2023, over 1 year ago
Updated 16 November 2023, over 1 year ago

Problem/Motivation

We are using the article content type to create a page with content and a responsive image (picture).

We are using a view to list all articles with only the image as a picture to be responsive. This image needs to be linkable to the detailed content.

Once I enable the "Linked field" for the image, then the "picture" dom object is replaced by an "img" and the HTML is not the good one.

Steps to reproduce

  • Ensure you have enabled the responsive image module (in the core) with some responsive configurations.
  • Create a custom display for article content type, ie, "Only Image"
  • Enable "Link field" for the image in the Manage display
  • Create a view page to show this Manage display
  • Go to the public page to show the results.
  • Inspect the source code of the element, you will see that "picture" is converted to "img".
🐛 Bug report
Status

Closed: duplicate

Version

1.5

Component

Code

Created by

🇪🇸Spain programeta

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

Comments & Activities

  • Issue created by @programeta
  • Assigned to ravi kant
  • Issue was unassigned.
  • 🇮🇳India ravi kant Jaipur

    The "linked_field" module is not compatible with Responsive Image module. I am replicating same issue.

  • 🇯🇵Japan josaku

    The modification such that the "linked_field" module becomes compatible with responsible image (picture tag), is not difficult since we just have to add a "if" branch to avoid further traversal to the inner source tags. However, this modification in this module does not solve the issue since the php's function called by Html::serialize may erase everything! Therefore, in mysite, we did everything in the theme.

  • 🇮🇳India ravi kant Jaipur

    @programeta
    Keep separate both fields(responsive image filed and link to content filed) and set position of "link to content" field on responsive image field.

  • Status changed to Closed: duplicate over 1 year ago
  • 🇮🇳India ravi kant Jaipur

    This ticket is duplicate of https://www.drupal.org/project/linked_field/issues/3197132 🐛 Linking breaks responsive image formats Fixed

Production build 0.71.5 2024