Hello,

In my opinion, the image styles is usable descriptions.

Before patch:

After patch:

Related issue: #606598: Human readable image-style names

CommentFileSizeAuthor
#70 1751634-nr-bot.txt144 bytesneeds-review-queue-bot
#64 After-patch.png146.98 KBRinku Jacob 13
#64 Before-patch.png140.02 KBRinku Jacob 13
#61 descripton_stored.png51.77 KBguilhermevp
#60 interdiff_1751634_59-60.txt814 bytesankithashetty
#60 1751634-60.patch21.28 KBankithashetty
#59 interdiff_1751634_57-59.txt816 bytesankithashetty
#59 1751634-59.patch21.28 KBankithashetty
#57 interdiff_1751634_54-57.txt1.66 KBankithashetty
#57 1751634-57.patch21.28 KBankithashetty
#54 interdiff_1751634_49-54.txt1.46 KBankithashetty
#54 1751634-54.patch21.21 KBankithashetty
#52 before-patch-image-styles-list.png74.85 KBdjsagar
#52 before-patch-image-styles.png131.92 KBdjsagar
#52 after-patch-image-styles-list.png81.15 KBdjsagar
#52 after-patch-image-styles.png89.59 KBdjsagar
#51 description-after-patch.png54.81 KBMadhu kumar
#51 description-before-patch.png60.03 KBMadhu kumar
#50 afterpatchdescriptionsaved.png30.59 KBguilhermevp
#50 afterstylepatch.png21.86 KBguilhermevp
#49 interdiff-1751634-47-49.txt629 bytesmohit_aghera
#49 1751634-49.patch21.17 KBmohit_aghera
#48 After_patch.png198.36 KBvikashsoni
#48 After_patch_added_description.png166.28 KBvikashsoni
#48 After_patch_description.png194.44 KBvikashsoni
#48 Before_patch_image_list_without_descritption.png189.91 KBvikashsoni
#48 Before_patch_image_style.png157.48 KBvikashsoni
#47 interdiff-1751634-38-47.txt18.23 KBmohit_aghera
#47 1751634-47.patch21.17 KBmohit_aghera
#38 interdiff_23-38.txt340 bytesnitesh624
#38 1751634-38.patch4.38 KBnitesh624
#27 Screen Shot 2020-05-13 at 6.37.40 PM.png105.99 KBjyotimishra-developer
#24 Screen Shot 2020-05-13 at 4.03.04 PM.png170.03 KBjyotimishra-developer
#24 1751634-24.png107.34 KBjyotimishra-developer
#23 1751634-23.patch3.9 KBhimanshu_sindhwani
#23 interdiff_10-23.txt1.99 KBhimanshu_sindhwani
#18 image_style_description-1751634-17.patch4.01 KBjyotimishra-developer
#14 interdiff_10-14.txt1.83 KBhimanshu_sindhwani
#14 1751634-14.patch3.88 KBhimanshu_sindhwani
#12 Screen Shot 2020-05-11 at 3.29.32 PM.png159.33 KBKristen Pol
#12 Screen Shot 2020-05-11 at 3.29.41 PM.png340.93 KBKristen Pol
#12 Screen Shot 2020-05-11 at 3.28.41 PM.png329.27 KBKristen Pol
#12 Screen Shot 2020-05-11 at 3.28.26 PM.png146.32 KBKristen Pol
#10 1751634-10.patch2.97 KBhimanshu_sindhwani
#7 1751634-7.patch2.97 KBhimanshu_sindhwani
#7 Screenshot 2020-05-07 at 6.08.35 PM.png169.52 KBhimanshu_sindhwani
#3 imagestyles1.png45.92 KBedmonkey
#3 contenttypes2.png27.41 KBedmonkey
image_styles_description.png40.87 KBnevergone
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

I don't see where and how this would be useful, or even displayed.

claudiu.cristea’s picture

Status: Active » Closed (won't fix)

This would be an edge case and doesn't make sense to add it in core, I agree with @sun.

However, if you still need that feature, you'll have to build a custom/contrib module and extend ImageStyle,ImageStyleFormBase and maybe other classes.

Closing with "won't fix".

edmonkey’s picture

Version: 8.0.x-dev » 9.0.x-dev
Issue summary: View changes
Status: Closed (won't fix) » Active
FileSize
27.41 KB
45.92 KB

I'd like to reopen this (8 years later!), as I feel descriptions would be valuable for providing use information or specific case details, and when dozens of image styles are created it would be useful too.

It could be displayed on the exisiting list styles page at /admin/config/media/image-styles
image styles UI

Similar to the content types list.
image styles UI

nitesh624’s picture

Assigned: Unassigned » nitesh624
nitesh624’s picture

Assigned: nitesh624 » Unassigned
xjm’s picture

Version: 9.0.x-dev » 9.1.x-dev
himanshu_sindhwani’s picture

Status: Active » Needs review
FileSize
169.52 KB
2.97 KB

Hi, you can use this patch to achieve this functionality of the image style description. It supports the config export as well. Tested it by importing and exporting.

description

Kristen Pol’s picture

Status: Needs review » Needs work

Thanks for the patch. I noticed a couple nitpicks with casing:

  1. +++ b/core/modules/image/src/Entity/ImageStyle.php
    @@ -28,9 +28,13 @@
      *   label = @Translation("Image style"),
    + *   label = @Translation("Image Description"),
    

    "Image style" is sentence-casing so "Image Description" should be "Image description" to match.

    This would be similar to most other examples in core, e.g.

    label_collection = @Translation("Shortcut sets"),
    label_collection = @Translation("Contact forms"),
    label_collection = @Translation("Aggregator feeds"),
    

    though I do see two using proper-name-casing, e.g.

    label_collection = @Translation("Content Language Settings"),
    label_collection = @Translation("Text Editors"),
    
  2. +++ b/core/modules/image/src/Entity/ImageStyle.php
    @@ -28,9 +28,13 @@
      *   label_collection = @Translation("Image styles"),
    + *   label_collection = @Translation("Image Description"),
    

    Same.

  3. +++ b/core/modules/image/src/Entity/ImageStyle.php
    @@ -28,9 +28,13 @@
      *   label_singular = @Translation("image style"),
    + *   label_singular = @Translation("image Description"),
    

    "image style" is all lowercase so "image Description" should be "image description" to match. When looking at other examples in core, they are mostly lowercase, e.g.

    label_singular = @Translation("shortcut set"),
    label_singular = @Translation("contact form"),
    label_singular = @Translation("comment type"),
    

    The only exceptions I see are when the text starts with an acronym, e.g.

    label_singular = @Translation("URL alias"),
    label_singular = @Translation("REST resource configuration"),
    
  4. +++ b/core/modules/image/src/Entity/ImageStyle.php
    @@ -28,9 +28,13 @@
      *   label_plural = @Translation("image styles"),
    + *   label_plural = @Translation("image Descriptions"),
    

    Same.

nitesh624’s picture

Assigned: Unassigned » nitesh624
himanshu_sindhwani’s picture

Status: Needs work » Needs review
FileSize
2.97 KB

Thanks for picking out these issues @kristen-pol, I have fixed these here.

Kristen Pol’s picture

@himanshu_sindhwani It's good to add an interdiff when making updates: https://www.drupal.org/documentation/git/interdiff

Kristen Pol’s picture

Did a quick test and was able to add/edit an image style description using the patch in #10. One thing I noticed was that although I could add multiple lines in the edit form, the formatting doesn't come across in the list though maybe that is similar behavior to other admin screens. I don't have time to double check right now but here are some screenshots.

nitesh624’s picture

Assigned: nitesh624 » Unassigned
himanshu_sindhwani’s picture

Hi @kristen-pol, thanks for your workaround. I have fixed the formatting issues. I have made it the same as the content listing on admin/structure/types.

One thing to note here if you want a new line you should try HTML tags like br tag after applying this new patch.

Kristen Pol’s picture

Status: Needs review » Needs work

Thanks. I don't have time for a proper review but I noticed a couple things.

  1. +++ b/core/modules/image/src/Entity/ImageStyle.php
    @@ -450,0 +451,8 @@
    +  public function getDescription() {
    +    return $this->get('description');
    +  }
    +
    +
    +  /**
    

    Nitpick: Remove extra new line.

  2. +++ b/core/modules/image/src/Form/ImageStyleFormBase.php
    @@ -68,6 +68,7 @@
    +      '#description' => t('This text will be displayed on the <em>Image styles</em> page.'),
    

    Change t to $this->t

jyotimishra-developer’s picture

Assigned: Unassigned » jyotimishra-developer
himanshu_sindhwani’s picture

Status: Needs work » Needs review
FileSize
1.99 KB
3.9 KB

Correcting these issues.

jyotimishra-developer’s picture

Updated patch as mentioned in #15. Please review.

jyotimishra-developer’s picture

Assigned: jyotimishra-developer » Unassigned
himanshu_sindhwani’s picture

Hi @jyotimishra123, I already fixed it in #16. Please don't hide the existing patches which are still running.

Kristen Pol’s picture

@himanshu_sindhwani Based on the timestamps for you and @jyotimishra123 this might have been a crosspost? Not sure.

Thanks for the update. I took a quick look and #17 covered items mentioned in #16. I don't have time for more review right now unfortunately.

jyotimishra-developer’s picture

Hi @himanshu_sindhwani, sorry!! but i did not hide any running existing patches intentionally, may be it was done by mistake..extremely sorry for this..When i saw this issue it was unassigned so i assigned it to myself and uploaded the patch but i guess our time matched, proof of this is my patch comment number..but you worked on it from starting so you are right my fault, but i thought its unassigned and you are not working on it hence i picked..Apologies again..my fault!!

himanshu_sindhwani’s picture

Oh! yeah I see this may be due to us posting comments without refreshing the page. No issues. I am again uploading the patch with the correct name.

jyotimishra-developer’s picture

Hi, patch in #23 is not working for me. I have applied this patch in different versions of Drupal like 8.8.9 and 9.1.0 but it did not work.
After applying patch, i can see the description fields in image-style but when i save image-style by adding value in description field it says configuration has been saved but get description field empty. same for listing page of image-style where i cannot see description value.
sharing screenshot for the same.

The steps i followed:
1. Apply patch in #23 - git apply patch
2. Go to image-style edit form to add description - base-url/admin/config/media/image-styles/manage/large
3. visit image-style listing page - http://localhost:8888/admin/config/media/image-styles

i did not get desired result.

jyotimishra-developer’s picture

Status: Needs review » Needs work
himanshu_sindhwani’s picture

Status: Needs work » Needs review

Hi @jyotimishra123, the patch is for Drupal version 9.1.x-dev, please check the version of the issue.

jyotimishra-developer’s picture

Hi @himanshu_sindhwani, the issue was not with version, it was cache issue on my Drupal instance. After clearing cache, patch in #23 is working absolutely fine and now m getting desired result. sharing screenshot for the same.
Thanks!!

jyotimishra-developer’s picture

This is RTBC from my side.

Kristen Pol’s picture

It didn't appear tests were triggered on the patch so I just started running them.

UPDATED: That didn't seem to work. Not sure why.

jyotimishra-developer’s picture

Hi @kristen Pol, Hope you fine!! Could you pleases elaborate because i am not able to understand what you saying in #29?
if you are trying to say that patch in #23 is not working then please try once with clearing the cache of Drupal instance.

Kristen Pol’s picture

If you look at #23 or any of the comments with patches, none of the automated tests ran. I tried to trigger them but it didn't work when I tried.

Kristen Pol’s picture

Status: Needs review » Needs work

Discussed this with @longwave in Slack and got permission to paste the discussion:

longwave  4 minutes ago
"build successful" often means that the tests failed badly and couldn't report any results (edited) 

longwave  3 minutes ago
the way to check is click on the test link itself e.g. https://www.drupal.org/pift-ci-job/1685386 then "View results on dispatcher" to give you some details

longwave  3 minutes ago
if you then click "Console output" you can see the full details but it is a lot to dig through

kristen_pol  3 minutes ago
Awesome, thanks for the help!

longwave  2 minutes ago
in the console output there are a lot of fatal errors during the tests

longwave  2 minutes ago
usually the best way is pick one of the failing tests and run just that locally and see what happens

longwave  1 minute ago
22:19:12 In ConfigSchemaChecker.php line 95:
22:19:12                                                                                
22:19:12   Schema errors for image.style.large with the following errors: image.style.  
22:19:12   large:description missing schema    

longwave  1 minute ago
this might be relevant

kristen_pol  < 1 minute ago
Woot! Thanks a ton

kristen_pol  2 minutes ago
@longwave Ok if I paste this discussion into the issue?

longwave  2 minutes ago
sure

kristen_pol  2 minutes ago
:thumbsup:

longwave  2 minutes ago
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for image.style.large with the following errors: image.style.large:description missing schema

longwave  1 minute ago
many tests are failing with this

longwave  1 minute ago
a schema needs adding for the new description config key, i think

Moving back to needs work to fix the schema issue.

IMO, if this feature ends up being accepted, @longwave should be given an issue credit. Thanks.

jyotimishra-developer’s picture

Hi @Kristen Pol
Great!!, the discussion you pasted here, is very informative..
Thank to you and @longwave.

jyotimishra-developer’s picture

Assigned: Unassigned » jyotimishra-developer
Kristen Pol’s picture

@jyotimishra123 It's good to un-assign the issue if you aren't able to get to it within a few hours. Thanks.

jyotimishra-developer’s picture

Assigned: jyotimishra-developer » Unassigned
nitesh624’s picture

Assigned: Unassigned » nitesh624
nitesh624’s picture

added description field in schema

nitesh624’s picture

Assigned: nitesh624 » Unassigned
Kristen Pol’s picture

Thanks for the update.

+++ b/core/modules/image/config/schema/image.schema.yml
@@ -9,6 +9,9 @@ image.style.*:
+    description:
+      type: text
+      label: 'Description'

I think this should be label to allow it to be translated though I see that block_content.schema.yml uses text.

Kristen Pol’s picture

Looking further I see that node.schema.yml also uses text so I guess this is ok as it's consistent with other code.

    description:
      type: text
      label: 'Description'
nitesh624’s picture

Issue tags: +Need test cases
Kristen Pol’s picture

Issue tags: -Need test cases +Need tests

If these needs tests, the proper tag is "Needs tests".

Kristen Pol’s picture

Issue tags: -Need tests +Needs tests

Whoops. Fixing tag.

nitesh624’s picture

ok thanks @Kristen Pol . I will take care of tags next time

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

mohit_aghera’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
21.17 KB
18.23 KB

Attempted following items:
- Fix test case failures
- Add method to check if added description is present in testStyle method.
- Remove overridden labels from the ImageStyle config Entity. Overridden lables causing issues in other site backend. We don't need to override or tweak labels as we are just adding the description field.

vikashsoni’s picture

Applied #10 patch is working fine added description field and saving value in the description field.
But #38 and #47 these patches not saving the value in description field
sharing the screenshot....

mohit_aghera’s picture

Attempted the following items in #47
- Fix test case failures
- Add method to check if the added description is present in testStyle method.
- Remove overridden labels from the ImageStyle config Entity. Overridden lables causing issues in other site backend. We don't need to override or tweak labels as we are just adding the description field.

Resolving PHPCs issues in this patch.

guilhermevp’s picture

Patch #49 stores description.

RTBC + 1

Madhu kumar’s picture

Above patch Working as expected , added description field & store the description.

Before Patch:

before-patch

After Patch:

after

djsagar’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
89.59 KB
81.15 KB
131.92 KB
74.85 KB

Patch no #49 is working fine in drupal9.2. i updated attachment and changing status.

claudiu.cristea’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/image/config/schema/image.schema.yml
    @@ -9,6 +9,9 @@ image.style.*:
    +    description:
    +      type: text
    +      label: 'Description'
    

    Should add nullable: true

  2. +++ b/core/modules/image/src/Entity/ImageStyle.php
    @@ -49,7 +49,8 @@
    + *     "description" = "description"
    

    Could we add a comma at the end of line?

  3. +++ b/core/modules/image/src/Entity/ImageStyle.php
    @@ -440,6 +449,13 @@ public function setName($name) {
    +  public function getDescription() {
    
    +++ b/core/modules/image/src/ImageStyleInterface.php
    @@ -28,6 +28,14 @@ public function getName();
    +  public function getDescription();
    

    As this is a new method we can strict type the method return.

ankithashetty’s picture

Updated patch in #49 addressing #53.1, #53.2 and #53.3, kindly review.

Thanks!

ankithashetty’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 54: 1751634-54.patch, failed testing. View results

ankithashetty’s picture

Status: Needs work » Needs review
FileSize
21.28 KB
1.66 KB

Trying to fix test failures.

Status: Needs review » Needs work

The last submitted patch, 57: 1751634-57.patch, failed testing. View results

ankithashetty’s picture

Status: Needs work » Needs review
FileSize
21.28 KB
816 bytes

Fixing test errors.

ankithashetty’s picture

Fixing custom commands failure errors.

guilhermevp’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
51.77 KB

Patch #60 still works and address the issues pointed at comment #53.

catch’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs issue summary update, +Needs product manager review

I'm not sure if we should add this either, so I'm tagging for product manager review.

Also, assuming we do add it - why not add descriptions to the image styles shipped with core and install profiles? Otherwise we're going to show a list of image styles with empty descriptions out of the box, which seems odd.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Rinku Jacob 13’s picture

FileSize
140.02 KB
146.98 KB

patch #60 applied successfully for 9.3.x-dev

Rinku Jacob 13’s picture

Kristen Pol’s picture

Issue summary: View changes

Updating issue summary with latest screenshots.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
144 bytes

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. 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.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.