Problem/Motivation
In LinksPropType, line 106, we cast $item["text"] as string:
if (array_key_exists("text", $item)) {
// Examples: links.html.twig, breadcrumb.html.twig, pager.html.twig,
// views_mini_pager.html.twig.
$item["title"] = (string) $item["text"];
unset($item["text"]);
}
However, sometimes $item["text"] is an array, found in Layout Builder with UI suite Bootstrap.
So, there is a warning which is breaking Layout Builder
Proposed resolution
- Try to reproduce the issue
- Test if $item["text"] is an array before casting
- If it is an array, investigate why ? A render array ? How to transform it to text?
Issue fork ui_patterns-3474641
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 #2
pdureau commentedguilty commit: https://git.drupalcode.org/project/ui_patterns/-/commit/2d6b275bc96b9e6e...
Comment #4
pdureau commentedHi Florent,
this issue is related to dropbutton renderables, which are a special case of "links", where each item's 'text' is a submit form element.
For example, UI Patterns 2 is doing that in the slots source selector:
The issue is triggered with ui_suite_bootstrap because PreprocessLinksDropbutton maps this
linksstructure todropdowncomponent.So, I am afraid just doing
if (array_key_exists("text", $item) && !is_array($item["text"]))will breaks something in UI Suite Bootsrap, where I already see a broken source selector for slots in Layout Builder.Can we check the MR together? https://git.drupalcode.org/project/ui_patterns/-/merge_requests/218
Comment #7
pdureau commentedComment #8
pdureau commented