Allow categories to have images to be used by the blocks when no image is on the block

Created on 8 June 2023, over 1 year ago
Updated 18 March 2024, 9 months ago

Problem/Motivation

You don't always have images per block and maybe want an image on the category as fallback so you don't need to set the fallback on the blocks itself.

Steps to reproduce

-

Proposed resolution

Allow to set an image and alt on the category.

Remaining tasks

Review merge request.

User interface changes

New options (Image and alt) for categories.

API changes

-

Data model changes

Adds image path and alt base fields.

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium tim-diels Belgium πŸ‡§πŸ‡ͺ

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

Merge Requests

Comments & Activities

  • Issue created by @tim-diels
  • Merge request !16Allow categories to have image β†’ (Merged) created by tim-diels
  • Status changed to Needs review over 1 year ago
  • πŸ‡§πŸ‡ͺBelgium tim-diels Belgium πŸ‡§πŸ‡ͺ

    I've provided the code to allow categories to have an image.
    This image will be used as fallback when the block has no image specified.
    If category doesn't have an image, the default behaviour is kept, so this is BC.
    Provided an update hook for the base fields on the categories.

  • πŸ‡ΊπŸ‡ΈUnited States codechefmarc

    I was able to test this one out and it works great! In looking at the code, do you need a getter/setter for your new fields in LayoutBuilderBrowserBlockCategory.php? I'm not as well versed in custom entities so not sure if that is required there or not.

    I have another patch which adds a generic fallback image to blocks that don't have an image or for reusable blocks at the bottom, if enabled. I tested both patches together and they work perfectly well to allow for category fallbacks and if they aren't set, the generic fallback works. If both of these get merged in, we should also change the language on the forms a bit to make sure that folks know which fallback image will be used depending on what is set.

  • Pipeline finished with Skipped
    10 months ago
    #110292
  • First commit to issue fork.
  • Status changed to Fixed 10 months ago
  • πŸ‡§πŸ‡ͺBelgium StryKaizer Belgium

    Mercie tim!

    Great addition.

    In a follow-up we might consider adding a fallback in the settings page too, so we can set either on category level or a global fallback image

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

Production build 0.71.5 2024