Problem/Motivation

It would be good to allow background-image gradients so they can be layered on top of image and/or used by themselves

Steps to reproduce

N/A

Proposed resolution

Add new fields and add to preprocess layout function.

Remaining tasks

Review

User interface changes

New Fields

API changes

None

Data model changes

New Fields

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

siramsay created an issue. See original summary.

siramsay’s picture

Please use the patch below.

siramsay’s picture

Issue summary: View changes
siramsay’s picture

Assigned: siramsay » Unassigned
StatusFileSize
new6.05 KB

Adding a patch or use checkout the issue branch.

sourabhsisodia_’s picture

Assigned: Unassigned » sourabhsisodia_
siramsay’s picture

Status: Active » Needs review

Code on branch works https://git.drupalcode.org/issue/layout_builder_backgrounds-3493451/-/tr...,

And so does patch.

Adding needs reviews.

siramsay’s picture

Issue summary: View changes

sourabhsisodia_’s picture

StatusFileSize
new732.56 KB
new468.91 KB

@siramsay I have reviewed the changes and the changes looks good. Although I have fixed some code formatting issue in your commit and after pushing code to a branch we need to create a MR into the branch we need to implement these changes . So raised a MR.
Attaching screenshot for reference . RTBC ++.

sourabhsisodia_’s picture

Assigned: sourabhsisodia_ » Unassigned
Status: Needs review » Reviewed & tested by the community
siramsay’s picture

Assigned: Unassigned » siramsay
Status: Reviewed & tested by the community » Needs work

@sourabhsisodia_ Thanks for fixing the coding standards, my IDE put those curly brackets on the next line.

I am changing this back to needs work. Please cancel MR. I can't do that for some reason.

siramsay’s picture

I am working on this.

siramsay’s picture

StatusFileSize
new1.31 MB

With the default field length of 128 it was not possible to add long gradients such as the example below which is 210 char.
I have made the field max length 256 char.
I have added a help note below the field.

linear-gradient(217deg, rgb(255 0 0 / 80%), rgb(255 0 0 / 0%) 70.71%),
linear-gradient(127deg, rgb(0 255 0 / 80%), rgb(0 255 0 / 0%) 70.71%), 
linear-gradient(336deg, rgb(0 0 255 / 80%), rgb(0 0 255 / 0%) 70.71%)
siramsay’s picture

StatusFileSize
new4.39 KB

New patch for longer gradient strings.

siramsay’s picture

This works but could be better. People could add strings longer than 256 char.

siramsay’s picture

Assigned: siramsay » Unassigned