Skip to content

Issue #3539899 by circuitcipher: Fix Layout Builder compatibility for Media Gallery

When a media gallery is used within Layout Builder, the render array structure for the fields is different. This was causing the gallery's images and pager not to be rendered correctly.

This commit adapts the module to be compatible with Layout Builder by:

  • Detecting when the gallery is being rendered inside a Layout Builder block.
  • Traversing the Layout Builder render array to find the images field.
  • Refactoring the preprocessing logic to handle both the default view and the Layout Builder view.
  • Simplifying the media gallery template file.
  • Updating kernel tests to assert the correct render array structure.

Related to #3539899

Merge request reports

Loading