- Issue created by @pdureau
- @pdureau opened merge request.
- 🇫🇷France pdureau Paris
Hi Grimreaper,
this issue is related to 🐛 Library: other group placed first Active which has introduced
label
&category
properties.I changed the logic to fix the TypeError but it may not be enough.
Are we comfortable with the addition of
label
&category
properties to all definitions? We are adding them to a kind of public interface.For
category
, we may have no choice.But for
label
, why not use the$label_key = 'name'
property instead?public function getSortedDefinitions(?array $definitions = NULL, $label_key = 'label'); public function getSortedDefinitions(?array $definitions = NULL, $label_key = 'label');
- 🇫🇷France Grimreaper France 🇫🇷
why not use the $label_key = 'name' property instead?
It was to minimize changes of 🐛 Library: other group placed first Active because default value for $label_key of CategorizingPluginManagerTrait is "label". So to avoid to edit all calls to getSortedDefinitions or getGroupedDefinitions, especially in case of usage in other contrib ui_patterns modules, or custom code.
So to avoid a breaking change.
- 🇫🇷France Grimreaper France 🇫🇷
I changed the moment default name is set.
Ok on my side, please retest on your side.
Automatically closed - issue fixed for 2 weeks with no activity.
- 🇬🇧United Kingdom juc1
I have tested and it seems that ui_patterns 2.0.x-dev fixes the php error caused by any sdc having a missing "name" key:
=============================
previous version of UI Patterns:
/admin/appearance/ui/components is ok
but /admin/structure/types/manage/page/display/default/display_builder =
php error:
ltrim(): Argument #1 ($string) must be of type string, Drupal\Core\StringTranslation\TranslatableMarkup given in ltrim() (line 569 of /var/www/html/web/modules/contrib/display_builder/src/Plugin/display_builder/Island/ComponentLibraryPanel.php).
===================
ui_patterns 2.0.x-dev :
/admin/structure/types/manage/page/display/default/display_builder loads normally
Clear caches =
Warning: Undefined array key "name" in Drupal\ui_patterns\ComponentPluginManager->processDefinitionCategory() (line 151 of modules/contrib/ui_patterns/src/ComponentPluginManager.php).
========================================
By the way, with the current warning message I have to go hunting through numerous sdc's to find the culprit sdc with a missing name key - so it might be good if the warning message from ComponentPluginManager.php could include the culprit component ID.