Created on 30 January 2025, 2 months ago

Steps:

  1. fresh install of https://github.com/TravisCarden/ddev-drupal-xb-dev,
  2. enable xb_dev_standard
  3. Visit xb/node/1/editor

AssertionError: assert($items->count() === 1) in assert() (line 27 of modules/contrib/experience_builder/src/Plugin/Field/FieldFormatter/NaiveComponentTreeFormatter.php).

per @larowlan in Slack https://drupal.slack.com/archives/C072JMEPUS1/p1738270791767019?thread_t...

that sounds like a bug in the formatter, can you open a separate issue for that one

He also posted code (which I didn't test)

`diff --git a/src/Plugin/Field/FieldFormatter/NaiveComponentTreeFormatter.php b/src/Plugin/Field/FieldFormatter/NaiveComponentTreeFormatter.php
index 7b7a4751..9bd65c50 100644
--- a/src/Plugin/Field/FieldFormatter/NaiveComponentTreeFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/NaiveComponentTreeFormatter.php
@@ -24,6 +24,9 @@ class NaiveComponentTreeFormatter extends FormatterBase {
    * {@inheritdoc}
    */
   public function viewElements(FieldItemListInterface $items, $langcode) {
+    if ($items->isEmpty()) {
+      return [];
+    }
     assert($items->count() === 1);
     assert($items[0] instanceof ComponentTreeItem);
     // This field type is single-cardinality: delta 0 is rendered.
πŸ› Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US

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

Comments & Activities

Production build 0.71.5 2024