Fallback image for reusable blocks or blocks that have no image

Created on 15 December 2023, about 1 year ago

Problem/Motivation

We are using the feature where we're automatically adding reusable blocks to the interface. It works great, but all of our other blocks use images to show what they are used for whereas the reusable blocks don't have an image. We don't need anything specific here, but it would be nice to have a fallback image so the interface looks more consistent.

Steps to reproduce

1. In the Layout Builder Browser settings form, add some block bundles for reusable blocks and save.
2. Create a reusable block in that category in the core blocks interface (/block/add?destination=/admin/content/block)
3. On a node, enter layout builder. Click "Add block" and scroll to the bottom of the list to see any reusable blocks that are available.
4. Notice that currently, there is just a text link for the reusable block.

Proposed resolution

1. Add in a fallback image and image alt into the settings form. I already have a patch in the works and will post it here after saving this issue.
2. If there are no images set for any regular block already in Layout Builder Browser or for reusable blocks, use this image path and alt as a fallback.

Remaining tasks

Upload patch and testing.

User interface changes

Yes, see screenshots attached. Settings form change as well as, if a fallback is set, using the fallback for reusable blocks and/or blocks without images.

API changes

None.

Data model changes

Yes, 2 new config strings: fallback image path and fallback image alt text.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States codechefmarc

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