LogicException caused by renderRoot from SimpleGMapAddressFormatter

Created on 29 July 2020, over 4 years ago
Updated 30 September 2024, 3 months ago

Problem/Motivation

Rendering the build array of a Address field with the SimpleGMapAddressFormatter formatter throw the exception below :

LogicException: A stray renderRoot() invocation is causing bubbling of attached assets to break. in Drupal\Core\Render\Renderer->renderRoot() (line 138 of core/lib/Drupal/Core/Render/Renderer.php).
Drupal\simple_gmap\Plugin\Field\FieldFormatter\SimpleGMapAddressFormatter->viewElements(Object, 'en') (Line: 89)
Drupal\Core\Field\FormatterBase->view(Object) (Line: 285

Proposed resolution

Change the code below

$address_html = $this->getRenderer()->renderRoot($elements[$delta]);

To

$address_html = $this->getRenderer()->render($elements[$delta]);
🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇫🇷France xavier.masson Haute-Normandie

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.

Production build 0.71.5 2024