Problem/Motivation

Discovered at #3469442-6: Impossible to drop a component into an empty column of the two.

Quoting \Drupal\KernelTests\Components\ComponentRenderTest::checkRenderElementAlters():

      '#propsAlter' => [
        fn ($props) => [...$props, 'heading' => $this->t('I am another banner')],
      ],

If you put a breakpoint there, you can indeed see all props:

Quoting from that same test:

      '#slotsAlter' => [
        static fn ($slots) => [...$slots, 'banner_body' => ['#markup' => '<h2>Just something else.</h2>']],
      ],

If you put a breakpoint there, you do NOT see all slots, but just the value/contents of one slot at a time:

If you look at the altered result, the problem is clear:

👆 Rather than having added #markup to banner_body, we've altered banner_body => ['#markup' ⇒ …] into banner_body 😅

Steps to reproduce

See above.

Proposed resolution

TBD — AFAICT fixing this requires a BC break? 😬

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

Wim Leers created an issue. See original summary.

quietone’s picture

Version: 11.0.x-dev » 11.x-dev

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.