Problem/Motivation

The view block title is outputed as an array like:

$output['#title'] = ['#markup' => $this->view->getTitle(), '#allowed_tags' => Xss::getHtmlTagList()];

When rendering a view block and displaying the view title, the next warning is shown
Warning: Array to string conversion in Drupal\Component\Utility\Html::getClass() (line 75 of core/lib/Drupal/Component/Utility/Html.php).
This warning cames from 'templates/BASE/components/00-theme/02-molecules/00-block/_block.twig' on line #87
where title (which is an array when is the title of a view) is passed as the argument to the clean_class filter.

Steps to reproduce

  • Render a block view with a view title
  • Check the id of the heading it will be like heading-array-20222906

Proposed resolution

Ensure the title is a string when is passed as argument to clean_class filter.

CommentFileSizeAuthor
#2 3293294-2.patch846 bytessdstyles

Comments

sdstyles created an issue. See original summary.

sdstyles’s picture

Status: Active » Needs review
StatusFileSize
new846 bytes

  • rembrandx committed 534c3cd on 3.x authored by sdstyles
    Issue #3293294 by sdstyles: Fix warning: Array to string conversion in...
rembrandx’s picture

Status: Needs review » Reviewed & tested by the community
rembrandx’s picture

I've added the fix to the 3.x dev branch, will add it to the next release. Still picking up a few other tickets first.
Thanks for providing a patch!

rembrandx’s picture

Version: 3.x-dev » 3.7.0
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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