Problem/Motivation

If description_display is changed to "before", the classes (and therefore the "description" class) are no longer added to the the description.

Steps to reproduce

For a form element, observe the classes added in form-element.html.twig. Change description_display to "before" and observe that the classes no longer appear.

Proposed resolution

Add the classes.

Remaining tasks

Review, merge.

User interface changes

None except that certain classes will now appear as intended.

Introduced terminology

None.

API changes

None.

Data model changes

None.

Release notes snippet

Issue fork drupal-2700439

Command icon 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

tomzoocha created an issue. See original summary.

tomzoocha’s picture

Status: Active » Needs review
StatusFileSize
new606 bytes

I've created a patch for this issue.

I added the ".addClass" function to the "before" block, as it is in the "after" block.

star-szr’s picture

Version: 8.0.4 » 8.1.x-dev
Component: Stable theme » forms system
Status: Needs review » Needs work

Thanks. There is a chance this would be something we can fix in Stable if I understand correctly but needs more thought as to whether it will break things. We definitely want to fix the core form element template though so needs work for that.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

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

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

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

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should 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.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should 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.

nikhil_110’s picture

StatusFileSize
new610 bytes

Attached patch against Drupal 9.5.x

ashutosh ahirwal’s picture

Assigned: tomzoocha » Unassigned
Status: Needs work » Needs review
Issue tags: +Novice
StatusFileSize
new617 bytes

Providing Patch for D9.5.

markconroy’s picture

Status: Needs review » Needs work

This looks like it is a bug, however we'll need to fix it in more than just Stable9. I think we need to fix it in:

  1. theme: starterkit_theme
  2. theme: stable
  3. theme: stable9
  4. theme: demo_umami > classy
  5. module: system

It's already fixed in Olivero and Claro (Claro issue: #3081563: When a form field's description is set to display before the input, it doesn't get the description classes)

The patch in #15 is the preferred approach. #16 has a space between the div and the expression (<div {{ instead of <div{{.

rishabh vishwakarma’s picture

Status: Needs work » Needs review
StatusFileSize
new3.12 KB
new1.92 KB

Addressed the points mentioned in #18.

rishabh vishwakarma’s picture

StatusFileSize
new3.12 KB
new1.91 KB

Modified the approcah IGNORE #19

The last submitted patch, 19: 2700439-19.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 20: 2700439-20.patch, failed testing. View results

rishabh vishwakarma’s picture

Status: Needs work » Needs review
StatusFileSize
new2.42 KB
new1.91 KB

Removed the changes from the theme: demo_umami > classy as it is causing test failures.

markconroy’s picture

@Rishabh Vishwakarma Thanks for working on this.

I wonder could you move the form-element.html.twig file from umami > classy directory to umami > templates > form directory (I think you'll need to create that directory).

I'm not sure if that will also break the tests, but it's worth trying. If that does break the tests, then we have another (perhaps bigger) issue for Umami if we can add new generic templates that have the same name as templates in the umami > classy directory.

Also, I think it's worth creating this patch against 10.1.x rather than 9.5.x

smustgrave’s picture

Status: Needs review » Needs work
Aadhar_Gupta’s picture

Status: Needs work » Needs review
StatusFileSize
new5.99 KB

Created the patch for drupal 10.1.x and also addressed the issue as stated in #24

markconroy’s picture

Status: Needs review » Needs work
+++ b/core/profiles/demo_umami/themes/umami/templates/form/form-element.html.twig
@@ -0,0 +1,95 @@
+    <div{{ description.attributes }}>

We need to add the description classes to this item. Once that's done, I think this is ready for RTBC.

Aadhar_Gupta’s picture

Status: Needs work » Needs review
StatusFileSize
new6.02 KB
new649 bytes

Applied changes according to #27

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

LGTM

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 28: 2700439-28.patch, failed testing. View results

markconroy’s picture

Status: Needs work » Needs review

Setting to 'needs review' to get the bots to test again.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Think it was a random failure

star-szr’s picture

Status: Reviewed & tested by the community » Needs work
   {% if description_display == 'before' and description.content %}
-    <div{{ description.attributes }}>
+<div{{ description.attributes.addClass(description_classes) }}>

Thanks for the work on this! Why do we change the indentation like this, in multiple files? Earlier versions of the patch don't have this change. Please maintain the same indentation level.

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new6 KB
new1.78 KB

Updated patch #28 by addressing #33, please review it.

Thanks!

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

indentation seems fixed

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/system/templates/form-element.html.twig
    --- /dev/null
    +++ b/core/profiles/demo_umami/themes/umami/templates/form/form-element.html.twig
    

    I think we should just move the template out from the Classy directory and then fix it. I don't think we want to have duplicate templates there.

  2. +++ b/core/profiles/demo_umami/themes/umami/templates/form/form-element.html.twig
    --- a/core/themes/stable9/templates/form/form-element.html.twig
    +++ b/core/themes/stable9/templates/form/form-element.html.twig
    
    +++ b/core/themes/stable9/templates/form/form-element.html.twig
    @@ -70,7 +70,7 @@
    -    <div{{ description.attributes }}>
    +    <div{{ description.attributes.addClass(description_classes) }}>
    

    Seems fine as a bug fix for Stable 👍

markconroy’s picture

Status: Needs work » Needs review
StatusFileSize
new2.7 KB
new6.37 KB

Here's a patch that removes (renames) template from templates/classy/form to templates/form, and fixes the issue there so there's no duplicate template.

Status: Needs review » Needs work

The last submitted patch, 37: 2700439-37.patch, failed testing. View results

markconroy’s picture

This has failed because the template was removed from the classy directory but I can't find the test to remove the template name from the list of classy templates - https://git.drupalcode.org/project/drupal/-/tree/10.1.x/core/tests/Drupa... (no test in here for ConfirmClassyCopiesTest)

lauriii’s picture

Version: 9.5.x-dev » 10.1.x-dev
Status: Needs work » Needs review

It exists in 9.5.x: https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/tests/Drupal.... I sent the patch to be re-tested in 10.1.x.

markconroy’s picture

Oh great, thanks @lauriii

arunkumark’s picture

StatusFileSize
new271.07 KB
new256.55 KB

Reviewed the patch manually and the fixes are working as expected. Attached screenshot for reference.

Before patch applied:

Before applied

After Patch applied:

Apply patch

The patch can be move for RTBC.

markconroy’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 37: 2700439-37.patch, failed testing. View results

markconroy’s picture

Status: Needs work » Reviewed & tested by the community

Not sure why the bots reset this, moving back to RTBC

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 37: 2700439-37.patch, failed testing. View results

rpayanm’s picture

Status: Needs work » Reviewed & tested by the community

I am told that they've had a random test failure explosion the past few days.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 37: 2700439-37.patch, failed testing. View results

smustgrave’s picture

Status: Needs work » Reviewed & tested by the community

Random

markconroy’s picture

I think it's because of the 9.5 tests failing. Hopefully we'll get this committed soon and not need to keep resetting it.

9.5.x: PHP 8.1 & MySQL 5.7 30,310 pass, 1 fail 🤖 re-tests every 2 days

larowlan’s picture

Status: Reviewed & tested by the community » Needs work

The patch is failing in 9.5 with what looks like a relevant failure from this issue.

If this should be applied to 9.5, we need a 9.5 patch too.

Thanks folks

Vidushi Mehta’s picture

Status: Needs work » Needs review
StatusFileSize
new6.03 KB

#37 was applying on 9.5.x after the latest pull, adding a patch for 9.5.x for the same.

smustgrave’s picture

Status: Needs review » Needs work

Umami has that template already. Under templates/classy.

markconroy’s picture

Status: Needs work » Needs review
StatusFileSize
new3.98 KB

@larowlan and @lauriii I'm not fully sure how to fix this for 9.5.x

  1. If we leave the template for form-element.html.twig inside umami/templates/classy then we have a duplicate template (like we have in #52 and #23 (we're starting to go around in circles).
  2. If we move it from there (like in the patch I am attaching to this, the test for classy templates will fail unless we remove form-element.html.twig from the ConfigClassyCopiesTest test. I have removed that in this test, but now it will mean that all other themes in 9.5 that have a classy folder will fail, since they will have a form-element.html.twig file which the test says they should not have.

My proposal: commit my patch from #37 so we have D10 fixed and either figure out how to solve it for D9, or don't worry about it as D9 is EOL in November.

There's no interdiff with this patch, as it's purely for 9.5 instead of D10 which #37 solves.

larowlan’s picture

Thanks @markconroy - I'll defer to @lauriii in his FEFM capacity w.r.t what his preference would be

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new85 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

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

lauriii’s picture

This seems like a good fix for Stable and Classy, but since we are adding additional classes for some use cases, it may have an impact on existing themes. Because of the changes to Classy and Stable, I think we may want to err on the side of caution and refrain from backporting to 10.0.x and 9.5.x.

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.

saurav-drupal-dev’s picture

StatusFileSize
new722.61 KB

unable to reproduce due to missing steps. tried patch applied successfully not tested yet.
patch

saurav-drupal-dev’s picture

liam morland made their first commit to this issue’s fork.

liam morland’s picture

Status: Needs work » Needs review
Issue tags: -Needs steps to reproduce

Edit: The steps to reproduce are clear to me.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update, +Needs change record

Shouldn't remove a tag without saying why.

But since the entire issue summary needs updating (steps to reproduce included) I've added that tag.

Twig template change will require a CR as well.

Thanks.

liam morland’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update
arunkumark’s picture

Created the Draft Change record for the issue. Feel free to edit the description. The screenshot needs to be updated.

Change Record: https://www.drupal.org/node/3482370

liam morland’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record

I have updated the change record.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record updates

I'd recommend removing the part about this applies to the core templates and themes. Purpose of the CR is to announce a change that other themes may won't to adapt if they have overridden or included in their base theme.

Would also recommend a simple before/after snippet of the change and maybe mention the classes that will now be applied.

liam morland’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record updates

Change record updated.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Cleaning up issue and updated CR.

catch made their first commit to this issue’s fork.

nod_ made their first commit to this issue’s fork.

  • nod_ committed 05b42068 on 11.x
    Issue #2700439 by rishabh vishwakarma, markconroy, Aadhar_Gupta, liam...

nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed 05b4206 and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.