Compatibility with layout builder

Created on 22 March 2022, over 2 years ago
Updated 28 May 2024, 4 months ago

Problem/Motivation

I'm trying to add a Chart block as Layout Builder component using a custom block type with Easychart field. I'm not able to save the block because of the following error:
TypeError: Argument 2 passed to Drupal\easychart\EasychartHelper::easychartPrintChart() must be of the type string, null given, called in /var/www/docroot/modules/contrib/easychart/src/Plugin/Field/FieldFormatter/Easychart.php on line 36 in Drupal\easychart\EasychartHelper::easychartPrintChart() (line 25 of /var/www/docroot/modules/contrib/easychart/src/EasychartHelper.php)

It looks like the view action is triggered before the block entity is created, so ID is not available yet.

Steps to reproduce

  1. Install Easychart module (8.x-3.5);
  2. Add Easychart module to block type;
  3. Add an instance of this block to page layout (layout builder);
  4. Try to hit save - it won't let you

Proposed resolution

Use uuid property, which is supposed to be unique across multiple entity types and even Drupal instances.
In the current version, there might be some collisions when 2 entities have the same IDs but different entity types. Using UUID identifier will make sure it wouldn't happen.

πŸ’¬ Support request
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine Matroskeen πŸ‡ΊπŸ‡¦ Ukraine, Lutsk

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.

  • πŸ‡ΏπŸ‡¦South Africa Gomez_in_the_South

    Whilst the earlier fix was merged, this was only to the 3.x branch, and the commit was never included in the 4.x branch.

    Due to this, I encountered the same issue as originally described, using Drupal 10.2 and EasyChart 4.0.9 (with Layout Builder).

    I have attached a re-roll of the earlier patch, but for 4.x.

Production build 0.71.5 2024