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.
Comments
Comment #2
sdstyles commentedComment #4
rembrandx commentedComment #5
rembrandx commentedI'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!
Comment #6
rembrandx commented