Form element template collision with views exposed filter

Created on 1 August 2025, 2 months ago

Problem/Motivation

The twig template form-element--rating.html.twig has a collision with the the form element generated by core's views exposed filters when the filter identifier is "rating" causing it to display incorrectly.

By default it uses the theme's form-element.html.twig template but when the element is named rating it uses the form-element--rating.html.twig template from this module instead.

Steps to reproduce

Proposed resolution

Use a more precise way of theming the rating element than applying to all form elements with the machine name of "rating"

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

3.2

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @rhovland
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    This can probably be resolved by namespacing the form element name to something like "rate_rating"

  • Pipeline finished with Failed
    2 months ago
    Total: 327s
    #562880
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    Hmm nope that just breaks the widget. I didn't dig very deep into how the module works. Need to do more work

  • Pipeline finished with Success
    2 months ago
    Total: 207s
    #564571
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    Ok this is working now. Tests pass, and a manual test works too. And no more misapplied template.

    There is one phpstan error, which seems unrelated to the changes made.
    tests/src/Kernel/migrate/RateWidgetMigrationTest.php

     * @covers \Drupal\rate\Plugin\migrate\source\RateWidgetTypes
     * @covers \Drupal\rate\Plugin\migrate\source\RateWidgetOptions

    Saying this is an invalid class, which makes sense because those files don't exist anymore. Seems to be a project level error. Maybe phpstan rules updated?

Production build 0.71.5 2024