Problem/Motivation

When the active theme implements preprocess hooks for templates supplied by its base theme, theme_path will point to the active theme, no longer the base theme. This causes missing ids in the form error divs.

Steps to reproduce

  • Install Drupal 9.3.0
  • Create a theme with classy as base theme
  • Implement template_preprocess_form_element in this theme
  • Activate the theme
  • Submit the user login form on user/login without data
  • Notice that div.form-item--error-message has no id
  • While with the patch the div is <div id="edit-name--errormessage" class="form-item--error-message">...</div>

Proposed resolution

Check the template path instead of the theme path.

Comments

Heine created an issue. See original summary.

sutharsan’s picture

Issue summary: View changes
sutharsan’s picture

Status: Active » Reviewed & tested by the community

The patch has no style problems. I can confirm that the patch fixes the bug and it is already used in several of our projects.

sutharsan’s picture

This patch will break Drupal 8 sites and therefore limit the backwards compatibility of the module. This requires a new branch.

The issue will be committed on the 2.0.x branch.

  • Heine authored 30fdc73 on 2.0.x
    Issue #3228773 by Heine: Core template overrides not working on a...
sutharsan’s picture

Version: 8.x-1.0-beta2 » 2.0.x-dev
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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