Type Error when trying to add background image to view

Created on 17 July 2024, 3 months ago

Problem/Motivation

I am unable to add a background image to a view. When I try to add this, I get:

TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string, Drupal\Core\Link given in htmlspecialchars() (line 440 of core/lib/Drupal/Component/Utility/Html.php).

I should also add that there is no widget to add a background image to a view, and the blog used as the documentation doesn't mention this at all. I was able to find a way to add the image to a view, but this results in the above error.

I am able to add background images to other entities.

Steps to reproduce

After installing the module:

  1. Open Background Image in admin toolbar, click the settings tab
  2. Enable view. I also switched the embed slider to advanced
  3. Switch to the Background Images tab
  4. Click "Add background image"
  5. Select Type "View" and select the existing view from the list, then click continue
  6. Error appears

I am not sure if this is the way the module expects background images to be added to views. I have also tried to go to the view itself and adding "Global: Rendered entity - Background Image (Global: Rendered entity - Background Image)" to the header, but this results in no change.

Existing Issues

I found issue 3446229 📌 Error when try to add background image Fixed that discusses something similar happening on the 2.0.x-dev@dev branch, and it looks like a MR has been submitted. I am not using the dev branch though.

Another duplicate is 3368941, but the patch is a year old and older than the latest update so I have not attempted the patch.

I decided to open a new issue to specifically address this issue on the 2.0.2 version.

Desired Solution

I want to confirm if adding a background image should work or if it is not an existing feature yet. Following this, I want to confirm if this issue can be fixed with a patch, or if I should switch to the dev branch.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada ciesinsg

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

Comments & Activities

Production build 0.71.5 2024