Latest version's smart_trim_update_10201() function doesn't work with layout_builder

Created on 22 June 2023, about 1 year ago
Updated 2 February 2024, 5 months ago

Problem/Motivation

When entity view display uses layout builder, than smart_trim_update_10201() function doesn't work, so need to manually re-save all such configs.

Steps to reproduce

Install module with version 2.0.0, create CT, enable layout builder and use it to configure entity view display of created CT.
Update module to 2.0.1 version and run DB updates.

Proposed resolution

Update code of smart_trim_update_10201() function in order to support entity view displays, which use layout builder.

Remaining tasks

Provide patch/MR, review it and merge. Or decline this task.

πŸ“Œ Task
Status

Needs work

Version

2.1

Component

Code

Created by

πŸ‡·πŸ‡ΊRussia ilya.no

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

Comments & Activities

  • Issue created by @ilya.no
  • Status changed to Postponed: needs info about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States ultimike Florida, USA

    I am unable to reproduce this issue. Here's what I did (on a fresh D10 install):

    Installed Smart Trim 2.0.0.
    Configured the teaser view mode of a content type to use Layout Builder.
    Configured the body field for the content type in teaser view mode to be smart trimmed (20 words).
    Confirmed things were working as expected.
    Updated to Smart Trim 2.1.0
    Ran database updates.
    Reviewed the settings for the same body field in the teaser view mode of my content type using Layout Builder, they were still intact (20 words).
    Confirmed things were still working as expected.

    @ilya.no any chance you can provide more details on your situation? Did my steps above adequate to reproduce the issue you had?

    Would also be good for someone else to try to reproduce the issue.

    -mike

  • First commit to issue fork.
  • @codebymikey opened merge request.
  • Status changed to Needs review 11 months ago
  • Created a post_update hook which addresses the issue for layout_builder displays.

    @ultimike, the thing of note is making sure the config is updated to match the expected structure. I've attached a stripped down snippet of a view display config for reference purposes.

    Another thing of note is that there's no upgrade paths for node-specific layout builder overrides, but that's not a use-case that's of a high enough priority for me right now, so this addresses the immediate issue quite well.

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States markie Albuquerque, NM

    Rebased.. waiting for tests

  • Status changed to Needs work 11 months ago
  • πŸ‡ΊπŸ‡ΈUnited States ultimike Florida, USA

    Tests have passed - I would like to see a new test associated with this though...

    I'm going to put this back on "Needs work" for a new test, but if @markie feels strongly about it, then he can merge it - and take full responsibility if it breaks something :p

    -mike

  • πŸ‡ΊπŸ‡ΈUnited States jrb Raleigh-Durham Area, NC, USA

    Just FYI, the proposed change won't fix this issue in layouts created by the Layout builder library β†’ module (used on 14K sites). The structure of its configurations is different from that of Layout Builder, so it wouldn't be simple to just add in support for updating them. For our site, we ended up just manually editing the config.

    Who knows how many other modules may be supporting fields that could possibly use Smart Trim, so I don't know if it's realistic for you to support every use case. Unless there were some other way for you to find where Smart Trim was used? We grepped the config directory, but that wouldn't help with automatically fixing the config.

    Maybe it would make sense to just output a warning message that says something like this?

    If you're using Smart Trim in places other than entity view displays, you may need to manually update its configuration.

Production build 0.69.0 2024