Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
In my opinion, the image styles is usable descriptions.
Before patch:
After patch:
Related issue: #606598: Human readable image-style names
Comment | File | Size | Author |
---|---|---|---|
#70 | 1751634-nr-bot.txt | 144 bytes | needs-review-queue-bot |
#64 | After-patch.png | 146.98 KB | Rinku Jacob 13 |
#64 | Before-patch.png | 140.02 KB | Rinku Jacob 13 |
#61 | descripton_stored.png | 51.77 KB | guilhermevp |
#60 | interdiff_1751634_59-60.txt | 814 bytes | ankithashetty |
Comments
Comment #1
sunI don't see where and how this would be useful, or even displayed.
Comment #2
claudiu.cristeaThis 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".
Comment #3
edmonkey CreditAttribution: edmonkey commentedI'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
Similar to the content types list.
Comment #4
nitesh624Comment #5
nitesh624Comment #6
xjmComment #7
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Material for Drupal India Association commentedHi, 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.
Comment #8
Kristen PolThanks for the patch. I noticed a couple nitpicks with casing:
"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.
though I do see two using proper-name-casing, e.g.
Same.
"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.
The only exceptions I see are when the text starts with an acronym, e.g.
Same.
Comment #9
nitesh624Comment #10
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Material for Drupal India Association commentedThanks for picking out these issues @kristen-pol, I have fixed these here.
Comment #11
Kristen Pol@himanshu_sindhwani It's good to add an interdiff when making updates: https://www.drupal.org/documentation/git/interdiff
Comment #12
Kristen PolDid 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.
Comment #13
nitesh624Comment #14
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Material for Drupal India Association commentedHi @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.
Comment #15
Kristen PolThanks. I don't have time for a proper review but I noticed a couple things.
Nitpick: Remove extra new line.
Change
t
to$this->t
Comment #16
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedComment #17
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Material for Drupal India Association commentedCorrecting these issues.
Comment #18
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedUpdated patch as mentioned in #15. Please review.
Comment #19
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedComment #20
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Material for Drupal India Association commentedHi @jyotimishra123, I already fixed it in #16. Please don't hide the existing patches which are still running.
Comment #21
Kristen Pol@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.
Comment #22
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedHi @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!!
Comment #23
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Material for Drupal India Association commentedOh! 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.
Comment #24
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedHi, 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.
Comment #25
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedComment #26
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Material for Drupal India Association commentedHi @jyotimishra123, the patch is for Drupal version 9.1.x-dev, please check the version of the issue.
Comment #27
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedHi @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!!
Comment #28
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedThis is RTBC from my side.
Comment #29
Kristen PolIt 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.
Comment #30
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedHi @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.
Comment #31
Kristen PolIf 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.
Comment #32
Kristen PolDiscussed this with @longwave in Slack and got permission to paste the discussion:
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.
Comment #33
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedHi @Kristen Pol
Great!!, the discussion you pasted here, is very informative..
Thank to you and @longwave.
Comment #34
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedComment #35
Kristen Pol@jyotimishra123 It's good to un-assign the issue if you aren't able to get to it within a few hours. Thanks.
Comment #36
jyotimishra-developer CreditAttribution: jyotimishra-developer commentedComment #37
nitesh624Comment #38
nitesh624added description field in schema
Comment #39
nitesh624Comment #40
Kristen PolThanks for the update.
I think this should be
label
to allow it to be translated though I see that block_content.schema.yml usestext
.Comment #41
Kristen PolLooking further I see that
node.schema.yml
also usestext
so I guess this is ok as it's consistent with other code.Comment #42
nitesh624Comment #43
Kristen PolIf these needs tests, the proper tag is "Needs tests".
Comment #44
Kristen PolWhoops. Fixing tag.
Comment #45
nitesh624ok thanks @Kristen Pol . I will take care of tags next time
Comment #47
mohit_aghera CreditAttribution: mohit_aghera as a volunteer and at QED42 commentedAttempted 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.
Comment #48
vikashsoni CreditAttribution: vikashsoni as a volunteer and at Zyxware Technologies commentedApplied #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....
Comment #49
mohit_aghera CreditAttribution: mohit_aghera as a volunteer and at QED42 commentedAttempted 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.
Comment #50
guilhermevp CreditAttribution: guilhermevp at CI&T commentedPatch #49 stores description.
RTBC + 1
Comment #51
Madhu kumar CreditAttribution: Madhu kumar as a volunteer and at Zyxware Technologies commentedAbove patch Working as expected , added description field & store the description.
Before Patch:
After Patch:
Comment #52
djsagar CreditAttribution: djsagar at OpenSense Labs commentedPatch no #49 is working fine in drupal9.2. i updated attachment and changing status.
Comment #53
claudiu.cristeaShould add
nullable: true
Could we add a comma at the end of line?
As this is a new method we can strict type the method return.
Comment #54
ankithashettyUpdated patch in #49 addressing #53.1, #53.2 and #53.3, kindly review.
Thanks!
Comment #55
ankithashettyComment #57
ankithashettyTrying to fix test failures.
Comment #59
ankithashettyFixing test errors.
Comment #60
ankithashettyFixing custom commands failure errors.
Comment #61
guilhermevp CreditAttribution: guilhermevp at CI&T commentedPatch #60 still works and address the issues pointed at comment #53.
Comment #62
catchI'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.
Comment #64
Rinku Jacob 13 CreditAttribution: Rinku Jacob 13 at Zyxware Technologies commentedpatch #60 applied successfully for 9.3.x-dev
Comment #65
Rinku Jacob 13 CreditAttribution: Rinku Jacob 13 at Zyxware Technologies commentedComment #66
Kristen PolUpdating issue summary with latest screenshots.
Comment #70
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe 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.