Problem/Motivation

When enabling this module with our Dripyard themes, we're getting the following warning on components that don't provide a schema (should be optional)
Warning: Undefined array key "name" in Drupal\ui_patterns\ComponentPluginManager->processDefinitionCategory() (line 151 of /var/www/html/web/modules/contrib/ui_patterns/src/ComponentPluginManager.php)

Steps to reproduce

Add a component with no schema. Clear cache, see the warning.

Proposed resolution

Follow what processDefinitionCategory does with no `name` is available.

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

andyg5000 created an issue. See original summary.

andyg5000’s picture

Status: Active » Needs review

just_like_good_vibes made their first commit to this issue’s fork.

just_like_good_vibes’s picture

Assigned: Unassigned » pdureau

Dear andyg5000,
thank you for reporting.
As already mentioned in the code, sdc component definitions without names is not a good practice, and those changes would rather being made directly to the mentioned themes.
But to support those practices in the wild, i have just updated the code :)
Note that there was already a line of code to cope with definition's names missing , but it seems that in your use case processDefinitionCategory was called without a prior call to processDefinition, seems strange to me but anyway i have added this new check and factorize the existing behavior inside a new protected method "cleanDefinition" instead of duplicating it in processDefinition and processDefinitionCategory.
MR to review is [!448]

just_like_good_vibes changed the visibility of the branch 3550802-undefined-array-key to hidden.

pdureau’s picture

Title: Undefined array key "name" in Drupal\ui_patterns\ComponentPluginManager->processDefinitionCategory() » [2.0.11] Undefined array key "name" in ComponentPluginManager::processDefinitionCategory()
Assigned: pdureau » just_like_good_vibes
Status: Needs review » Reviewed & tested by the community

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Reviewed & tested by the community » Fixed

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

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

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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