Add Latest Gallery Items block with multiple layout options

Created on 28 August 2025, 18 days ago

Problem/Motivation

Currently, the Media Gallery module provides ways to view individual galleries, but lacks a built-in feature to display an aggregated feed of the most recent media items from across all galleries. Site administrators need a simple, configurable way to showcase fresh content in various regions of the site, but no such block component exists.

Steps to reproduce

1. Navigate to the block layout page (/admin/structure/block).
2. Click "Place block".
3. Search for a block that displays the latest media items from all galleries.
4. Observe that no such block is available.

Proposed resolution

This change introduces a new "Latest Gallery Items" block that is highly configurable and addresses the problem by:

1. Adding a new Block Plugin: A LatestGalleryItemsBlock is now available to be placed in any theme region.
2. Creating a Layout Plugin System: A new MediaGalleryLayout plugin type has been created. This allows developers to easily add new visual presentations for the block.
3. Providing Multiple Layouts: The block ships with several layouts out-of-the-box, including "Grid", "Featured Image Grid", "Horizontal", "Vertical", and "Swiper".

4. Adding a Rich Admin UI: The block configuration form uses AJAX to provide a dynamic experience, allowing administrators to select a layout, configure its specific settings, and see a preview.

5. Ensuring Quality: The new functionality is covered by both kernel and functional JavaScript tests.

Remaining tasks

None.

User interface changes

- A new "Latest Gallery Items" block is now available on the Block Layout page.
- The block configuration form provides a new UI for selecting and configuring different layouts for the block.
- The block renders a list of the latest media items on the site's frontend.

API changes

- A new plugin type, MediaGalleryLayout (@MediaGalleryLayout), is introduced for creating different layouts for the block.
- A new MediaGalleryLayoutInterface and MediaGalleryLayoutBase are available for developers who wish to create their own layout plugins.
- New services are added to manage and render the media gallery layouts.

Data model changes

- New configuration schema is added to store the settings for the "Latest Gallery Items" block, including the selected layout and its specific configuration. This is defined in media_gallery.schema.yml.

✨ Feature request
Status

Active

Version

3.1

Component

Default

Created by

πŸ‡ΊπŸ‡ΈUnited States circuitcipher

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024