Problem/Motivation

I enabled ui patterns 2 on my site and get these errors
Warning: Undefined array key "entity_embed_fake_entity" in Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getEntityFieldsMetadata() (line 319 of modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php).

Warning: Undefined array key "field_storages" in Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getDerivativeDefinitionsForEntityFieldStorages() (line 411 of modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php).

Warning: foreach() argument must be of type array|object, null given in Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getDerivativeDefinitionsForEntityFieldStorages() (line 411 of modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php).

Warning: Undefined array key "label" in Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getDerivativeDefinitionsForEntityFieldStorages() (line 422 of modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php).

Warning: Undefined array key "metadata" in Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getDerivativeDefinitionsForEntityFieldStorages() (line 430 of modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php).

Warning: Undefined array key "properties" in Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getDerivativeDefinitionsForEntityFieldStorages() (line 442 of modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php).

Proposed resolution

Adding if isset on each one of them will solve the issue.

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

yasmeensalah created an issue. See original summary.

just_like_good_vibes’s picture

Hello,
thank you for reporting you error.
Would you share with us, the list of enabled contrib and core modules please?
from the trace, i may guess "entity_embed"?
many thanks in advance

nidhish’s picture

@yasmeensalah, Could you mention the drupal version on which you are getting the following issues?

yasmeensalah’s picture

Hi,
answering @just_like_good_vibes:
Yes i have entity_embed, and most probably it's causing both errors

@nidhish
I have Drupal 10.4.1. , after updating ui-patterns to 2.0.0-rc2 most of the issues have been resolved (all issues listed here https://www.drupal.org/project/ui_patterns/issues/3498456)

Only 2 things are left (filed storage line 416) and (entity_embed_fake_entity line 322)

just_like_good_vibes’s picture

Hello @yasmeensalah,
thanks, i will try to reproduce and post the correction

just_like_good_vibes’s picture

Status: Active » Needs review
just_like_good_vibes’s picture

Title: Undefined array key(s) in Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase » [2.0.0-rc3] Undefined array key(s) in Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase

just_like_good_vibes’s picture

Status: Needs review » Fixed
steveoriol’s picture

Yes, the changes correct the problem I have on 2.0.0-rc2
Great, thanks!

pdureau’s picture

Status: Fixed » Closed (fixed)