Field Template Suggestions Not Getting $variables['settings']

Created on 6 October 2020, over 4 years ago
Updated 26 December 2023, about 1 year ago

Problem/Motivation

I have created a Twig Template for the Expert layout for a DS field. The suggestion and template work, however I have noticed that the $variables['settings'] which control Wrappers and such in the Expert field is not getting set as expected in the suggestions.

I did some digging looking at ds.module and it seems that in ds_theme_registry_alter(), specifically the Workaround code starting at Line 154, it appears that not all possible suggestions are being processed here. It seems that field--ds-field-expert--*.html.twig will have the Settings variable set correctly, but the actual suggestions which are: field--expert--* do not.

Steps to reproduce

  1. Start with a content type using a View Mode with a DS layout selected.
  2. Edit a Field to use the Expert field template.
  3. Create a custom Twig template based on the suggestions for that field (eg: field--expert--{field_name}.html.twig
  4. Clear cache, reload page. Any settings added to the Expert Wrappers will not load correctly.
  5. Use drupal dump to view the Settings variable, should return Null.

Proposed resolution

Initial ideas are to expand suggestions, or to update the Field Suggestion workaround to be more inclusive for all possible suggestion patterns.

πŸ› Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States TXChetG

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.

Production build 0.71.5 2024