Fences block template (block--fences.html.twig) should add default CSS Classes

Created on 20 January 2023, almost 2 years ago
Updated 23 January 2023, almost 2 years ago

Problem/Motivation

With separate fences block templates, it seems that the default block classes are gone.

Not sure why the core template doesn't add any classes on blocks, but I don't think we should do this too.

Better use the classes set in the Olivero block template:

{%
  set classes = [
    'block',
    'block-' ~ configuration.provider|clean_class,
    'block-' ~ plugin_id|clean_class,
    layout ? 'layout--' ~ layout|clean_class,
  ]
%}

https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/themes/oliv...

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
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.

  • Assigned to Grevil
  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • 🇩🇪Germany Grevil

    As of #6, I'll put this back to needs work, so @thomas.frobieter can decide how to continue here?!

  • @thomas.frobieter would it instead make sense to inherit the attributes from the core template?

    As mentioned in the issue description, there are no classes/attributes in the core template, so there is nothing to inherit.

    So best would be to extend the currently active theme twig files implementation?

    This direction doesnt make any sense to me in context of this module. Fences Blocks provides the "base block template", it simply won't work in the other direction and I have no idea how it should (technicaly).

  • Status changed to Fixed almost 2 years ago
  • 🇩🇪Germany Grevil

    LGTM!

    Oh, already merged anyway. :D

  • 🇩🇪Germany Grevil

    Created a new rc2 release with the fixes from this issue!

    Should we also commit this change to the 8.x branch?

  • Yes, is think this is an improvement for the 8.x block.html.twig too and mhm.. yeah, seems very unlikely to break things.

  • @anybody opened merge request.
  • 🇩🇪Germany Anybody Porta Westfalica

    To sum things up here finally, after discussing this with @thomas.frobieter:

    Due to logical and technical reasons, we'll leave things as-is for now!

    • fences_blocks needs to overwrite the basic block implementation as it makes heavy changes, so extending the active template won't be helpful in most cases (but still discussable)
    • It's not that easy in the override order to extend things as we'd like to. See related issues.

    Perhaps we'll come to solutions and ideas later in a follow-up or if there are heavy issues. Currently this seems most robust way.

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

Production build 0.71.5 2024