Add field group preprocess

Created on 27 February 2024, 7 months ago
Updated 4 April 2024, 6 months ago

Problem/Motivation

There are preprocess functions for field and entity, but not field groups which are also supported by SDC Display.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

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

Merge Requests

Comments & Activities

  • Issue created by @mortona2k
  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    I'm not sure how to implement this.

    I started with a HOOK_field_group_pre_render_alter(). $element['component'] is available to populate, and I can get it to load the preprocess file for the groupname. But I think it should also look for files for each field, so it can work like the field preprocessor, but for the groups props/slots.

  • πŸ‡¨πŸ‡¦Canada ksere Montreal

    This is a good idea since field_group is a popular module and is used often with SDC.

    I'll continue off what you started and perform some tests.

  • πŸ‡¨πŸ‡¦Canada ksere Montreal

    Took a look, tested it, and I think what was done was already sufficient.

    When choosing to render a field group as a component, I don't think we need to look for files for each field. This is because the group as a whole will be rendered as the component, and all needed preprocessing should be able to be achieved within the one file. In the loaded file we'll have access to all props and slots for the given group.

    Did you think of a use case where individual files would be needed? I might be missing something.

  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    I'm a little fuzzy on this from when I last looked at it, it's possible I overlooked how it's supposed to work. I'll have to look into this closer next time I encounter the issue.

  • Merge request !2Resolve #3424196 "Add field group" β†’ (Merged) created by ksere
  • Status changed to Needs review 6 months ago
  • πŸ‡¨πŸ‡¦Canada ksere Montreal

    That's fine! I've gone ahead and opened a merge request with the work done so far. I think it's a good first version to at least support field group integration.

    • ksere β†’ committed efab3d93 on 1.0.x
      Issue #3424196 by mortona2k, ksere: Add field group preprocess
      
  • Status changed to Fixed 6 months ago
  • πŸ‡¨πŸ‡¦Canada ksere Montreal
  • Status changed to Fixed 6 months ago
  • πŸ‡¨πŸ‡¦Canada ksere Montreal

    Good to go in release 1.0.0-alpha2.

    We can open a new issue if what was discussed in #2 & #4 becomes a need down the line.

Production build 0.71.5 2024