- Merge request !13394[#3550051] fix: Convert attributes props to an Attribute object before Attribute::merge() → (Open) created by pdureau
Following 
            
              
              
              ✨
              Process #attributes render property
                Active
              
            , testing 11.3-dev with a few SDC themes and projects, I have met TypeError: Drupal\Core\Template\Attribute::merge(): Argument #1 ($collection) must be of type Drupal\Core\Template\Attribute, array given when there is already a SDC attribute prop with an array value.
Any component renderable with an array as attributes prop:
[
  '#type' => 'component',
  '#component' => 'foo:bar',
  '#attributes' => [
    'foo' => 'bar',
  ],
  '#props' => [
    'attributes' => [
      'lorem' => 'ipsum',
    ]
  ]
]ComponentElement::mergeElementAttributesToPropAttributes() is already aware about this issue:
// If attributes value is an array, convert it to an Attribute object as
// \Drupal\Core\Template\Attribute::merge() expects an Attribute object.
But it is converting the other value:
    $element_attributes = is_array($element['#attributes']) ? new Attribute($element['#attributes']) : $element['#attributes'];
So, let's keep this conversion and add the conversion of the value which must fit \Drupal\Core\Template\Attribute::merge() expectations.
We don't break anything. But we may need a new test.
Active
11.2 🔥
single-directory components
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.