[meta] Consensus Banana Phase 2, transition templates to the starterkit theme

Created on 1 October 2014, about 10 years ago
Updated 8 May 2023, over 1 year ago

Problem/Motivation

For phase 1 of the consensus banana, we moved all classes from preprocess into the templates. In phase 2, we will copy those templates into the new Classy theme and strip the module version of each template of all unnecessary classes. This meta issue will serve as a place to discuss the process, how we'll group the changes, how we'll group the templates in Classy, and how we will determine what classes get stripped.

Proposed resolution

Copy the templates modified in phase 1 to Classy, and remove the classes from the original template. When done, all core templates should be free of unneeded classes. See Steps and Examples for specifics.

Use this Goggle doc to keep track of the templates and organize them. https://docs.google.com/spreadsheets/d/1vc79t_bwRfMryyo63BCbHblLpJZqRSa2...

Priorities

We want to focus on the templates that matter most. Admin templates, and rarely modified/used templates are low priority. Concentrate on the following:

#2349625: Copy block templates to Classy
#2349721: Copy node templates to Classy
#2349759: Copy system templates to Classy (The system issue has been broken up into a series of child issues.)
#2349775: Remove classes from Views templates
#2349715: Copy link templates to Classy
#2349687: Copy image templates to Classy
#2349683: Copy forum templates to Classy
#2349659: Copy comment templates to Classy

Remaining discussion

How should we group the changes into child issues?

Done. See sidebar for child issues. They are grouped by module.

How do we group the templates in Classy?

Done. They will be placed in module subdirectories of Classy's templates folder. For example, "templates/block/block.html.twig". There is an issue to discuss reorganizing after we are done. #2349559: [meta] Discuss the organization of subfolders in Classy

Do we move the hard-coded classes?

<div{{ attributes.addClass('aggregator-item') }}>
  {{ title_prefix }}
  <h3 class="feed-item-title">

Yes, we will treat these the same as the attribute classes. Remove them for the original template if they are not considered functional.

Do we copy more templates than just the ones touched in phase 1?

Copy all templates.

Steps and Examples

  1. Copy the templates listed in the issue to 'core/themes/classy/templates'.
  2. Remove any classes in the original template.
  • Determine if the class being removed affects functionality or styling in core. (Check everything. JS, etc, and not just CSS.)
  • Discuss in the issue whether the class is important enough to be left in the original template.

Ideally, we don't want core modules setting style rules, so we'll need to discuss solutions for problems that arise.

Examples

Below is the node.html.twig template. Currently, residing in core/modules/node/templates.

{%
  set classes = [
    'node',
    'node--type-' ~ node.bundle|clean_class,
    node.isPromoted() ? 'node--promoted',
    node.isSticky() ? 'node--sticky',
    not node.isPublished() ? 'node--unpublished',
    view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
  ]
%}
<article{{ attributes.addClass(classes) }}>

  {{ title_prefix }}
  {% if not page %}
    <h2{{ title_attributes }}>
      <a href="{{ url }}" rel="bookmark">{{ label }}</a>
    </h2>
  {% endif %}
  {{ title_suffix }}

  {% if display_submitted %}
    <footer class="node__meta">
      {{ author_picture }}
      <div{{ author_attributes.addClass('node__submitted') }}>
        {% trans %}Submitted by {{ author_name|passthrough }} on {{ date|passthrough }}{% endtrans %}
        {{ metadata }}
      </div>
    </footer>
  {% endif %}

  <div{{ content_attributes.addClass('node__content') }}>
    {{ content|without('links') }}
  </div>

  {% if content.links %}
    <div class="node__links">
      {{ content.links }}
    </div>
  {% endif %}

</article>

Copy the template to core/themes/classy/templates. Then, remove the classes in the original template.

New original

<article{{ attributes }}>

  {{ title_prefix }}
  {% if not page %}
    <h2{{ title_attributes }}>
      <a href="{{ url }}" rel="bookmark">{{ label }}</a>
    </h2>
  {% endif %}
  {{ title_suffix }}

  {% if display_submitted %}
    <footer>
      {{ author_picture }}
      <div{{ author_attributes }}>
        {% trans %}Submitted by {{ author_name|passthrough }} on {{ date|passthrough }}{% endtrans %}
        {{ metadata }}
      </div>
    </footer>
  {% endif %}

  <div{{ content_attributes }}>
    {{ content|without('links') }}
  </div>

  {% if content.links %}
    <div>
      {{ content.links }}
    </div>
  {% endif %}

</article>
📌 Task
Status

Postponed: needs info

Version

10.1

Component
System 

Last updated 7 days ago

No maintainer
Created by

🇺🇸United States davidhernandez USA

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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.

  • 🇮🇪Ireland markconroy

    As per #110 this looks like it's now a core (system.module) issue rather than a Classy issue.

  • 🇫🇷France andypost

    Guess proper title

  • Status changed to Postponed: needs info over 1 year ago
  • 🇺🇸United States bnjmnm Ann Arbor, MI

    Given that it's been ~8 years and two major versions since any momentum of note, there's a strong possibility the there's been changes in the technical aspects or overall interest in this issue happening. This should be postponed until the requirements are made current, and we've confirmed the value of implementing those warrants the effort it would require.

    In other words, this can un-postpone

    • If it is confirmed this issue still worth doing 7+ years after the last notable activity
    • Confirm this is still worth doing given that this was proposed at a very early stage in Drupal 8+, and making these changes in current versions is potentially more disruptive.
    • The issue summary is updated to describe the steps with the current version of drupal.
Production build 0.71.5 2024