Problem/Motivation

Currently the summary generated from inline_errors_template has no template. Lets add one

Do we need one for form-item__error-message? Technically it runs through the form_element.html but wasn't super clear by the original post and certainly don't want to lose any of the desired request.

Proposed resolution

Add a template for the summary.

Do we need a new template for the error??

Remaining tasks

  1. Create an MR
  2. Review MR
  3. Write change record?

User interface changes

NA

API changes

N/A

Data model changes

N/A

Original Post

Inline error messages are currently using their own custom markup and CSS selectors (in other form elements) and using absolutely no theming mechanism in fieldsets.

They all should be using something similar to: http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/Render/Eleme...

Note that it should be using #theme and not #type (which will use any existing stored messages).

It should also use a theme hook suggestion so it can be specifically targeted when needed (such as in a base theme like Bootstrap so it can append the alert-sm class): '#theme' => 'status_messages__inline_form_errors'.

CommentFileSizeAuthor
#2 2980380-2.patch2.3 KBjrockowitz

Issue fork drupal-2980380

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

jrockowitz created an issue. See original summary.

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new2.3 KB
markhalliwell’s picture

Version: 8.x-4.x-dev » 8.x-3.x-dev
Category: Bug report » Feature request
Status: Needs review » Postponed (maintainer needs more info)

I'm tempted to say that this is actually a core issue and a fatal flaw of the Inline Form Errors module that was pushed through. It simply passes error messages but doesn't actually use any existing theming mechanisms to display them properly (i.e. setting the variable to a render array that, at the very least, mimics error status messages and uses a theme hook suggestion for the "inline" bit).

See: http://cgit.drupalcode.org/drupal/tree/core/modules/inline_form_errors/i...

jrockowitz’s picture

You are right core does include some styling for form element errors via .form-item--error-message and no error styling for fieldsets.

At the same time, the Bootstrap theme overrides the form-element.html.twig template to include custom error styles and the issue is that fieldset.html.twig is not being overridden.

markhalliwell’s picture

Title: Fieldsets do not style inline error message. » Inline error messages are not using proper theming mechanisms
Project: Bootstrap » Drupal core
Version: 8.x-3.x-dev » 8.6.x-dev
Component: Code » inline_form_errors.module
Category: Feature request » Bug report
Status: Postponed (maintainer needs more info) » Active

This is a core issue and oversight.

These error messages are currently using their own custom markup and CSS selectors (in other form elements) and using absolutely no theming mechanism in fieldsets.

They all should be using something similar to: http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/Render/Eleme...

Note that it should be using #theme and not #type (which will use any existing stored messages).

It should also use a theme hook suggestion so it can be specifically targeted when needed (such as in a base theme like Bootstrap so it can append the alert-sm class): '#theme' => 'status_messages__inline_form_errors'.

msankhala’s picture

Issue summary: View changes
markhalliwell’s picture

Issue summary: View changes
Issue tags: +Needs issue summary update

The IS needs work since it's not for Bootstrap specifically.

markhalliwell’s picture

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

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.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.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). 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.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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.

pameeela’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

Updated IS based on #5

pameeela’s picture

Issue tags: +Bug Smash Initiative

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.

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.

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.

joseph.olstad’s picture

the fieldset.twig.html still doesn't have the twig changes proposed by @jrockowitz
I've added this fieldset.twig.html in my theme but core should have that change suggested by @jrockowitz

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.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

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

smustgrave’s picture

Issue summary: View changes

Came here from #2880011: Add a #disable_inline_form_errors_summary property to disable the Inline Form Errors summary where it was suggested in #69 to add a summary template. So going to give it a shot to help inline_form_errors get polished to be included in the standard profile.

smustgrave’s picture

Status: Active » Needs review

Disclosure used AI to help write the unit test since this was a bug and didn't know what to include.

The javascript errors randomly failing has skyrocketed this weekend. But could use some eyes

dcam’s picture

I'm sorry my idea wasn't working out the way I suggested. I left some thoughts on the MR.

smustgrave’s picture

I also definitely like the markup being in the template too. We could try and use item-list template but would have to update tests to pass. Also not opposed to.

nicxvan’s picture

I think we would use item-list template since it is a list.

smustgrave’s picture

Assigned: Unassigned » smustgrave
Status: Needs review » Needs work

Okay will just need alter the render array, which shouldn't be a problem.

smustgrave’s picture

Status: Needs work » Needs review

Was able to get the template working but did have to edit the PathAliasTest because of some weird whitespace.

Even asked claude if something could be done in the template and the suggestion was to add {{- ' ' -}} which felt wrong.

And obviously had to refactor FormErrorHandlerTest because the list now gets ran through a template.

dcam’s picture

Issue tags: +Needs change record

This looks great. Thank you for continuing to work on it. The only difference between the rendered HTML from the new template and the old render array is the addition of a <span> around the error count list heading.

I've never added a template to Core before, but I assume it needs a change record to announce that the new template is available.

smustgrave’s picture

Issue tags: -Needs change record

CR added

dcam’s picture

Status: Needs review » Reviewed & tested by the community

Let's send it up.

joseph.olstad’s picture

Only 8 years, it can wait a few more yet :P

Aren't there many important deprecations to work on? Moooahahaha