[1.0.0-beta3] UI Patterns integration: fix warning

Created on 17 October 2024, 6 months ago

Problem/Motivation

Warning: Undefined array key "icon" in Drupal\ui_icons_patterns\Plugin\UIPatterns\SettingType\IconSettingType->preprocess() (line 48 of modules/ui_icons_patterns/src/Plugin/UiPatterns/SettingType/IconSettingType.php)

Proposed resolution

+++ b/modules/ui_icons_patterns/src/Plugin/UiPatterns/SettingType/IconSettingType.php
@@ -45,7 +45,7 @@ class IconSettingType extends PatternSettingTypeBase {
     }
     // Value not coming from ::settingsForm(), like component definition's
     // preview, has an already resolved flat structure with primitive only.
-    if (is_string($value['icon']) && isset($value['icon_pack'])) {
+    if (isset($value['icon']) && is_string($value['icon']) && isset($value['icon_pack'])) {
       return $value;
     }
📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France pdureau Paris

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024