Array to string conversion in Drupal\Core\Template\AttributeArray->__toString()

Created on 24 April 2019, over 5 years ago
Updated 28 January 2024, 11 months ago

Because the classes get converted to an array, most of the themes are throwing this notice when rendering such links:

Notice: Array to string conversion in Drupal\Core\Template\AttributeArray->__toString() (line 73 of core/lib/Drupal/Core/Template/AttributeArray.php).

Drupal\Core\Template\AttributeArray->__toString() (Line: 53)
Drupal\Core\Template\AttributeValueBase->render() (Line: 289)
Drupal\Core\Template\Attribute->__toString() (Line: 180)
Drupal\Core\Utility\LinkGenerator->generate('Facebook', Object) (Line: 94)
Drupal\Core\Render\Element\Link::preRenderLink(Array)
call_user_func(Array, Array) (Line: 378)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 490)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 122)

To solve this, the classes should remain a space separated string. I'm going to submit a patch shortly.

πŸ’¬ Support request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom robcarr Perthshire, Scotland

    I'm still getting this problem with Claro and a sub-theme based on stable9. The patch at #2 addresses the problem.

    Not the done thing to re-open a closed issue... so should I raise a new issue?

  • πŸ‡¬πŸ‡§United Kingdom robcarr Perthshire, Scotland

    Stand corrected... patch 2 applied yet error returned 10 minutes later

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Can we get a new issue for this with steps to reproduce. Sounds like #11 is a good starting point for that.

Production build 0.71.5 2024