Problem/Motivation

When DS field templates are enabled, the field template form renders on Layout Builder FieldBlocks but doesn't work.

Steps to reproduce

  • Enable DS Field Templates and the Layout Builder module
  • Enable Layout Builder on a Content type and click "Manage Layout"
  • Click "+Add Block" on a section and add any field block from the "Content field" section
  • Change the field template select - the form won't update with the selected field template settings

Proposed resolution

  1. Update the ds field template-related form and preprocessors to sniff out when the field is being rendered by Layout Builder and handle accordingly
  2. Add a setting to disable field templates in layout builder entirely. There are likely cases where you don't need field template support in layout builder but still want it on the Manage Display page.

Patch Incoming!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drclaw created an issue. See original summary.

drclaw’s picture

Here's a patch addressing the above!

drclaw’s picture

Status: Active » Needs review

Nees review

swentel’s picture

This is pretty cool, will review and test today!

  • swentel committed 1ae7345 on 8.x-3.x authored by drclaw
    Issue #3164071 by drclaw: Add Field Template support for Layout Builder...

  • swentel committed 44dc35d on 8.x-4.x authored by drclaw
    Issue #3164071 by drclaw: Add Field Template support for Layout Builder...
swentel’s picture

Status: Needs review » Fixed

Impressive! I had no idea field templates were exposed on the field blocks. Further more, they indeed currently trigger an error when changing the field template. So this patches fixes both the error and makes field templates actually work on rendering, even during the preview phase, that's so cool! And it has a test, even better :)

Committed and pushed to 8.x-3.x and 8.x-4.x thanks!
(removed an unused Cache import in the test)

Thanks! Will let it live a week or two in the dev branches so I can test it a bit more on production environments, although I don't expect any issues honestly.

drclaw’s picture

Awesome! Thanks for the quick review/response!! :)

Status: Fixed » Closed (fixed)

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