Field type image : need to add a default class to " img " element if Image style is set to " None (original image) "

Created on 22 February 2017, over 7 years ago
Updated 12 March 2023, over 1 year ago

Problem/Motivation

Default field template for image fields contains image name class, but no class when no class (original image) is displayed.

When using image style thumbnail:

<img property="schema:image" src="" width="100" height="42" alt="" typeof="foaf:Image" class="image-style-thumbnail">

When using None (original image):

<img property="schema:image" src="" width="100" height="42" alt="" typeof="foaf:Image" class="">

Proposed resolution

Add `image-style-none` class when image is displayed as original (no image style). This should be done in default field template file:

<img property="schema:image" src="" width="100" height="42" alt="" typeof="foaf:Image" class="image-style-none">

Remaining tasks

Submit the patch.

User interface changes

No UI change

API changes

New `image-style-none` CSS class exposed by default field templates.

Data model changes

No data changes.

🐛 Bug report
Status

Needs work

Version

10.1

Component
Image system 

Last updated about 1 hour ago

Created by

🇮🇳India vishwac9

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India sonam.chaturvedi Pune

    Verified and tested patch #90 on 10.1.x-dev
    Patch applied cleanly.

    Test Result: When image is displayed as original (no image style) > "image-style-none" class is added.
    Patch works as expected
    Screenshots available in #94

    RTBC

  • 🇮🇳India saket-001

    As mentioned in comment #95 patches work as expected and screeshots available in #94 for 10.1.x . so, i move this issue to RTBC.

  • @rashmisoni opened merge request.
  • First commit to issue fork.
  • Status changed to Needs work over 1 year ago
  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • First commit to issue fork.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue under control, following Review a patch or merge request as a guide.

    This seems more like a feature request but it will need a test assertion added somewhere. Should be a simple 1 liner.

    Leaning forwards it may need a change record but not 100%

Production build 0.69.0 2024