Update filter.module markup and templates

Created on 5 January 2014, over 11 years ago
Updated 10 March 2025, 27 days ago

Problem/Motivation

Feedback was brought up in #1898416-118: filter.module - Convert theme_ functions to Twig β†’ that some of the markup and logic in the filter.module theme functions/templates could be improved. The purpose of that issue was just to convert the existing markup and logic to Twig templates, this issue is to discuss changing it.

(The numbers do not match up with the original review as some of the points have been addressed or were not relevant to this follow-up issue.)

  1. +++ b/core/modules/filter/templates/filter-tips.html.twig
    @@ -0,0 +1,52 @@
    +  {% if multiple %}
    +    <div class="compose-tips">
    +  {% endif %}
    ...
    +    {% if multiple %}
    +      </div>
    +    {% endif %}
    ...
    +  {% if multiple %}
    +    </div>
    +  {% endif %}

    As a themer, the conditional output of the wrapper elements (and lack thereof) always resulted in a unexpected bad surprise when testing the design as anonymous user.

    I wonder whether we want to remove these 'multiple' conditionals as part of this conversion to (1) simplify the template and (2) prevent nasty surprises?

  2. +++ b/core/modules/filter/templates/filter-tips.html.twig
    @@ -0,0 +1,52 @@
    +    {% if multiple %}
    +      <div{{ tip.attributes }}>
    +      <h3>{{ tip.name }}</h3>
    +    {% endif %}

    The 'multiple' condition here looks wrong to me -- the wrapping container + heading is only used for the long filter tips; i.e., the condition should be 'long' instead.

    That said, it would be great if we could split these two completely different representations (short/list vs. long/page) into two separate templates. Having them in a single never really made sense to me.

Proposed resolution

Discuss the points from the review here and make updates as necessary.

Remaining tasks

Discuss
Patch

User interface changes

TBD

API changes

TBD

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

filter.module

Created by

πŸ‡¨πŸ‡¦Canada star-szr

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024