Problem/Motivation

Steps to reproduce

Fresh Drupal + UI Suite DaisyUI

Create new entity

  • Create a new Block Type
  • Re-use body field
  • Add title field (text short)
  • Add links field (multi valued)

Manage Display :

  • Choose default Display Builder
  • Goto Display Builder
  • Drag Card component on top of the present fields
  • Move title field to field slot
  • Move body field to text slot
  • Move links field to actions
  • For links field choose component per items
  • Use Button component
  • Map Label with field text
  • Map URL with field uri
  • Pulish

Block Layout:

  • Place content block of the new block type in a region
  • Contribute and save
  • Goto to front or Display Builder

Warning that displays :

Warning: foreach() argument must be of type array|object, string given in Drupal\display_builder\Hook\UiPatternsHooks->sourceValueAlter() (line 37 of modules/contrib/display_builder/src/Hook/UiPatternsHooks.php).
Drupal\display_builder\Hook\UiPatternsHooks->sourceValueAlter() (Line: 460)
Drupal\Core\Extension\ModuleHandler->alter() (Line: 168)
Drupal\ui_patterns\Element\ComponentElementBuilder->buildSource() (Line: 213)
Drupal\ui_patterns\Element\ComponentElementBuilder->buildSlot() (Line: 192)
Drupal\ui_patterns\Element\ComponentElementBuilder->buildSlots() (Line: 55)
Drupal\ui_patterns\Element\ComponentElementBuilder->build()
call_user_func_array() (Line: 107)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 910)
Drupal\Core\Render\Renderer->doCallback() (Line: 441)
Drupal\Core\Render\Renderer->doRender() (Line: 513)
Drupal\Core\Render\Renderer->doRender() (Line: 513)
Drupal\Core\Render\Renderer->doRender() (Line: 230)
Drupal\Core\Render\Renderer->render() (Line: 501)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 190)
__TwigTemplate_044db8ff822dc4126be90f9af5787569->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 133)
__TwigTemplate_3abd008037a57db26b95ec89c3e0b27b___1271818900->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 44)
__TwigTemplate_3abd008037a57db26b95ec89c3e0b27b->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 386)
Twig\Template->render() (Line: 51)
Twig\TemplateWrapper->render() (Line: 235)
Drupal\Core\Template\TwigEnvironment->renderInline() (Line: 54)
Drupal\Core\Render\Element\InlineTemplate::preRenderInlineTemplate()
call_user_func_array() (Line: 107)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 910)
Drupal\Core\Render\Renderer->doCallback() (Line: 441)
Drupal\Core\Render\Renderer->doRender() (Line: 513)
Drupal\Core\Render\Renderer->doRender() (Line: 513)
Drupal\Core\Render\Renderer->doRender() (Line: 513)
Drupal\Core\Render\Renderer->doRender() (Line: 230)
Drupal\Core\Render\Renderer->render() (Line: 501)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 97)
__TwigTemplate_9c4f73d8024879eca70ff938be5f9c76->block_content() (Line: 446)
Twig\Template->yieldBlock() (Line: 74)
__TwigTemplate_9c4f73d8024879eca70ff938be5f9c76->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 386)
Twig\Template->render() (Line: 51)
Twig\TemplateWrapper->render() (Line: 35)
Drupal\Core\Template\TwigThemeEngine->renderTemplate() (Line: 428)
Drupal\Core\Theme\ThemeManager->render() (Line: 500)
Drupal\Core\Render\Renderer->doRender() (Line: 253)
Drupal\Core\Render\Renderer->doRenderRoot() (Line: 143)
Drupal\Core\Render\Renderer->{closure:Drupal\Core\Render\Renderer::renderInIsolation():142}() (Line: 634)
Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():634}()
Fiber->resume() (Line: 649)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 142)
Drupal\Core\Render\Renderer->renderInIsolation() (Line: 169)
Drupal\Core\Render\Renderer->doRenderPlaceholder() (Line: 206)
Drupal\Core\Render\Renderer->renderPlaceholder() (Line: 730)
Drupal\big_pipe\Render\BigPipe->renderPlaceholder() (Line: 500)
Drupal\big_pipe\Render\BigPipe->{closure:Drupal\big_pipe\Render\BigPipe::sendPlaceholders():500}()
Fiber->resume() (Line: 510)
Drupal\big_pipe\Render\BigPipe->sendPlaceholders() (Line: 256)
Drupal\big_pipe\Render\BigPipe->sendContent() (Line: 116)
Drupal\big_pipe\Render\BigPipeResponse->sendContent() (Line: 403)
Symfony\Component\HttpFoundation\Response->send() (Line: 20)
Command icon 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

g4mbini created an issue. See original summary.

pdureau’s picture

This one is easy. Sometimes, empty third_party_settings are stored as an empty string instead of an empty array. I don't know why. Maybe it is a Drupal thing.

Proposal:

--- a/src/Hook/UiPatternsHooks.php
+++ b/src/Hook/UiPatternsHooks.php
@@ -34,6 +34,12 @@ class UiPatternsHooks {
       return;
     }
 
+    if (empty($source_configuration['third_party_settings'])) {
+      // Sometimes, third_party_settings are stored as an empty string instead of
+      // an empty array.
+      return;
+    }
+
pdureau’s picture

Title: Warning when building entity view on block type » Empty third_party_settings stored as a string instead of array

gurnoor kaur made their first commit to this issue’s fork.

gurnoor kaur’s picture

Status: Active » Needs review
mogtofu33’s picture

Status: Needs review » Needs work

mogtofu33’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.