Problem/Motivation
I'm using the Paragraph component in Canvas Bootstrap. When I clear the placeholder text, I get the following error message:
Twig\Error\RuntimeError occurred during rendering of component 41981e00-0dfa-44bb-b3cb-b8c6e5648955 in Page Untitled page (37), field components: An exception has been thrown during the rendering of a template (""value" is an invalid render array key. Value should be an array but got a string.") in "canvas_bootstrap:paragraph" at line 20.
Steps to reproduce
Drag Paragraph component into a Canvas page. Delete the placeholder text. The message will appear in the preview pane.
Issue fork canvas_bootstrap-3641386
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #6
bala.addweb commentedOpened an MR against
1.0.xthat fixes the Twig RuntimeError shown when the Paragraph component's text is cleared.Cause
When the text is cleared, Canvas passes
textas an array with a plainvaluekey. The template sees thattextis iterable and runs it through|render. Drupal then treats the array as a render array and fails with: "value" is an invalid render array key. Value should be an array but got a string.Fix
In
components/paragraph/paragraph.twig, iftextis iterable and has a non-iterablevalue, the template now uses that value directly. Real render arrays still go through|render, and plain strings work as before.Testing steps
Comment #7
bala.addweb commentedComment #9
alaa abbad commentedThanks @bala.addweb, reviewed and merged.