Problem/Motivation
Most entity types in Drupal have a description (content types, media types, menus, vocabularies, views, roles, etc. For sites built with a lot of custom form modes and view modes to manage how media is displayed on an entity, it would be helpful for site builders to be able to provide a description for each form/view mode to describe why the custom view mode was created.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | Screen Recording 2023-06-23 at 5.59.59 PM.mov | 5.21 MB | fadilraj |
Issue fork drupal-3364659
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
Comment #2
chris matthews commentedComment #3
lauriiiNice suggestion! This could be one potential way to try to address #2844203: Improve/Simplify situation around Default/Full view modes/view displays. 👍
Comment #4
chris matthews commentedHopefully #256287: Give roles a description value can get in too :)
Comment #5
prabuela commentedComment #6
prabuela commentedComment #9
lauriiiComment #12
utkarsh_33 commentedComment #13
utkarsh_33 commentedComment #14
fadilraj commentedComment #15
fadilraj commentedThe description field is added, but I was not able to edit and save the description of an existing display mode, nor was I able to save the description that I added while creating the display mode as seen in the screen recording attached below. Changing the status to 'Needs work' for now.
Comment #16
fadilraj commentedComment #17
sakthi_dev commentedUpdated the entity keys. Please review as it resolved the issue mentioned in #15.
Comment #18
smustgrave commentedWith updates to existing config it'll need an upgrade path.
Comment #19
tim.plunkettBecause all of the new values are '' or null, it shouldn't be needed. But an empty post_update hook could be added to force a cache clear
My question is that why are half of the new values '' and the other half are null?
Comment #20
utkarsh_33 commentedComment #21
bnjmnmCode all looks good, and most of the changes are just updating schemas to have an empty string for
description:. I also tested locally and added some descriptionless view modes that weren't part of the default install, and running update.php after switching to this branch added description support gracefully.Comment #22
longwaveIf this feature is actually useful should we provide some useful defaults, at least for new installs? Umami is also supposed to showcase best practices so we should add some descriptions there too I think.
Comment #23
bnjmnmRe #22 I'd like to make sure the description language gets the attention it deserves while not obstructing the addition of this functionality, so I created a followup to this for writing the actual descriptions #3371297: Compose view mode descriptions. There are also funded contributors able to work on it as part of Field UX efforts, so this wouldn't be a throwaway.
I'm setting it back to RTBC since that work is part of the queue, but if there's disagreement with this take I'm amenable.
Comment #24
lauriii+1 that it should be fine to add the view mode descriptions in a follow-up.
Haven't looked at the code in detail but I'm wondering if we should show the description in the Manage form display and Manage display pages too?
Comment #25
bnjmnmYeah that crossed my mind too. Since we know there's contributors tacking Field UX issues I'd be fine with that as another followup especially since it's a clean way to break the work down and keep the MRs smaller.
Comment #26
ckrina+1 to this.
Agree with you that we'd need to show this on:
Something similar to what Display Mode Guidelines is doing, but it'll need some work to create the mocks/come up with a visual solution to know where to place it and how it needs to look like, so a follow-up to discuss it would be great and we don't block this work.
Comment #27
lauriiiAdded few comments to the MR. 👍
Comment #28
bnjmnmCreated #3371389: Display view option descriptions in the Manage form display and Manage display pages for adding these to manage form display and manage form. Scoping it to its own issue will ensure we don't cut corners on the design choices.
Comment #29
lauriiiComment #30
lauriiiHmm, tests are failing because the typehint states that the property must be a string. This is not the case when a new display mode is being created because the description isn't set yet. We could either not use
\Drupal\Core\Entity\EntityDisplayModeInterface::getDescriptionthere or we could allow null values:Comment #31
sakthi_dev commentedComment #32
smustgrave commentedPlease don’t assign tickets to yourself unless a maintainer. A comment should do.
Comment #33
sakthi_dev commentedComment #34
tim.plunkett@sakthi_dev Sorry but those changes are not helpful, and are the wrong direction from what I described above.
Furthermore, @Utkarsh_33 has this issue well in-hand at this point.
Reverting the above, and applying my suggestions
Comment #35
lauriiiWent through all of the recent changes and the code. The upgrade path looks solid now. I'm a bit surprised how much complexity type hints add to the upgrade paths 😅
Comment #36
longwaveSome nitpicks in the docblock of the new method, and there is a merge conflict, otherwise this looks ready to go to me.
Comment #37
lauriiiApplied the suggestions and rebased the MR.
Comment #38
longwaveSomehow the rebase has lost most of @tim.plunkett's changes from this commit: https://git.drupalcode.org/project/drupal/-/merge_requests/4135/diffs?co...
Comment #39
bnjmnmThe changes lost with the rebase were successfully recovered by @lauriii
Comment #41
bnjmnmAfter a few un-RTBC at the final stretch, this looks all set and I've merged it to 11.x. Thanks all!
Comment #43
fadilraj commentedComment #44
_shyComment #45
_shy