Problem/Motivation

Needs to add a specific class when having background image option.
Having no custom styling selector for sections
to have advance styling for section with background.
bg-image, bg-color, bg-video

Steps to reproduce

Given that a Landing page with Layout Builder had number of sections
And number of sections do have a background color
And some sections have a background image or background video
When trying to select and custom style all sections with BG colors only
And same for BG images or videos
But with other styling
Then no direct way to select selections with BG colors, or BG image

Proposed resolution

Have the following

  1. .bg-color
  2. .bg-image
  3. .bg-video

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Add bg-color, bg-image, bg-video classes for sections with backgrounds
  • ✅ Testing to ensure no regression
  • ✅ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ✅ Code review from Bootstrap Styles team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Release bootstrap_styles-1.1.1

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Issue #3213112: Added a specific class when having sections with background color, image, or video option

Comments

n.ghunaim created an issue. See original summary.

n.ghunaim’s picture

StatusFileSize
new905 bytes
n.ghunaim’s picture

Status: Active » Needs review
n.ghunaim’s picture

n.ghunaim’s picture

mahmoud-zayed’s picture

Hi @n.ghunaim,

Would you explain why we need to add that class?

Thanks,
Mahmoud

mahmoud-zayed’s picture

Status: Needs review » Postponed (maintainer needs more info)
n.ghunaim’s picture

Hello @mahmoud-zayed,

I needed it to add specific styles when having background image.

Regards,
Noor

n.ghunaim’s picture

Status: Postponed (maintainer needs more info) » Needs review
drupgirl’s picture

Hi, thanks for this attempt. This patch did not apply when attempting to apply to the latest version of dev.

I assume the purpose of the class is for adding an overlay tint to the background image, as described in this issue, https://www.drupal.org/project/bootstrap_styles/issues/3163894.

I can go with adding the background image and overlay tint via straight CSS, but it would be cool to get this operational, as most images need a tint so that the text pops.

Thanks.

rajab natshah’s picture

Title: Add a specific class when having background image option. » Add a specific class when having background color, image, or video option
Assigned: n.ghunaim » Unassigned
Issue summary: View changes
Status: Needs review » Active
rajab natshah’s picture

Title: Add a specific class when having background color, image, or video option » Add a specific class when having sections with background color, image, or video option
rajab natshah’s picture

StatusFileSize
new1.85 KB

A patch for the latest 1.0.x-dev committed code

rajab natshah’s picture

A patch for the committed bootstrap_styles-1.0.3 tag release

rajab natshah’s picture

Status: Active » Needs review
drupgirl’s picture

Thank you, the patch for bootstrap_styles-1.0.3 applied and a class can be added to a section with a backround image. However this is also possible by applying a "container wrapper classes".

My particular goal is to be able to add a linear gradiant over the background image, but this is not possible because the image is added using background-image and not background.

What would be ideal is being able to get the following result:

background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url(/sites/default/files/file.jpg);

What we currently get with either method:

<div class="class-banner tint white _none" style="background-image: url(/sites/default/files/image.jpg); background-position: center top; background-repeat: no-repeat; background-size: cover;">

So my issue is outside of the scope of this issue and more inline with the issue in https://www.drupal.org/project/bootstrap_styles/issues/3163894, where it looks like they specifically had a background image overlay at some point in time.

Thanks for your help!

abu-zakham’s picture

StatusFileSize
new1.76 KB

Re-roll patch #15

qusai taha’s picture

StatusFileSize
new2.06 KB

Fix issue when adding background color the class bg-color adding, but when deleting the color the class will not remove.
patch to fix the issue on 1.0.x

qusai taha’s picture

Fix issue when adding background color the class bg-color adding, but when deleting the color the class will not remove.
patch to fix the issue on tag 1.0.3

rajab natshah’s picture

Version: 1.0.x-dev » 2.0.x-dev
rajab natshah’s picture

StatusFileSize
new1.83 KB

Do not use this patch.
Not sure, when I removed the "$build['#theme_wrappers'][$theme_wrapper]['#attributes']['style'][] = $background_image_style;"
It had got mixed with other issue #3299909: Fix Layout Builder section rendering original Background Image when no background options, no image styles, or lazy loading are applied
which to be fixed in the next stage.

rajab natshah’s picture

StatusFileSize
new1.72 KB

Re-roled the patch to work with 1.1.0

rajab natshah’s picture

guido_s’s picture

Thx Rajab, #23 works for me on 1.1.0 and helped a lot with styling!

rajab natshah’s picture

Issue summary: View changes
Status: Needs review » Fixed
rajab natshah’s picture

Issue tags: +bootstrap_styles-1.1.0
rajab natshah’s picture

rajab natshah’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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