Problem/Motivation
pattern Twig function from ui_patterns_legacy has this signature: (string $id, array $fields = [], $variant = "")
So, attributes object must be passed with $fields, mixed with the other props and the slots.
component Twig function has this signature: (string $component_id, array $slots = [], array $props = [])
So, attributes object must be passed with $props, mixed with the other props.
Proposed resolution
Is attributes correctly moved to #attributes property before being processed by SDC render element ?
Some tests with https://www.drupal.org/project/ui_suite_uswds show it may be failing.
Issue fork ui_patterns-3462818
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
Comment #2
pdureau commentedIt is not a UI Patterns 2 issue but a Core SDC issue.
#attributesproperty, which is an expected "classic" of render elements is not processed:That's not good because many Drupal mechanisms are expecting this render property and inject data in it.
That also shows than, one year after the landing of SDC in Drupal Core, only a few people is using it with the Render API.
A dirty fix would be to add this to ComponentElement::preRenderComponent():
But we need to :
$props["attributes"]attributeobject is created (not in ComponentElement, which is surprising)Comment #5
pdureau commented