Wrapper / item behavior consolidation

Created on 18 January 2023, over 1 year ago
Updated 8 June 2024, 19 days ago

Problem/Motivation

The issue ✨ Allow to apply classes on Layout Builder block wrapper Fixed raised the concern of wrapper/item handling and consolidation of the behavior of applying styles to render elements.

Proposed resolution

A first draft of guidelines discussed with @pdureau:

If there is a wrapper => if only one child apply on the child otherwise on the wrapper if multiple children
If no wrapper => apply to all the children => Done in ✨ Block content styles are not applied when an embedded entity does not use layout_builder Fixed

If layout builder => apply to all the sections

Remaining tasks

-
- Loop on sections when layout builder
- uniformize between Element::isAcceptingAttributes then Element::addClasses like for Layout Builder and $this->addStyleToBlockContent()

πŸ“Œ Task
Status

Needs work

Version

1.0

Component

Miscellaneous

Created by

πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·
  • Issue was unassigned.
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·
  • πŸ‡«πŸ‡·France pdureau Paris

    We need to rethink the "drilling" without breaking compatibility (we stay in 1.x)

    Because they are 2 issues:

    • First, the wrapping happens to early, instead of first looking down the render tree.
    • )

    • Second, the current implementation shows our lesser knowledge of the Render API 4 years ago. We are better and more confident now.

    1. Let's create a lot of unit test with various render tree. Some will be OK with current codebase, they are the regression we want to avoid. Some will be KO with the current codebase, they are the improvements we want to achieve.

    2. Let's implement a recursive function which is drilling/digging the render tree to find a renderable (or a list of renderables, like we already do for in UI Patterns ) which accept an attribute object. If none is found, we go back to the top of tree and we add the wrapper.

    Doing so, let's find a more elegant and generic way, all in one place :

    • Removing the logic from StylePluginManager::addClass() (and maybe removing this method in UI Styles 2.0.0)
    • Removing the StylePluginManager::addStyleToBlockContent() method
    • Removing the StylePluginManager::addStyleToFieldFormatterItems() method
  • First commit to issue fork.
  • Merge request !56Implement class drilling. β†’ (Open) created by lexbritvin
  • Pipeline finished with Success
    20 days ago
    Total: 201s
    #194364
  • πŸ‡·πŸ‡ΊRussia lexbritvin

    Reworked the drilling.
    We lack some Functional tests for the fixed case when we have block layout builder with multiple sections.

  • Status changed to Needs work 19 days ago
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·
Production build 0.69.0 2024