- Issue created by @idiaz.roncero
- Merge request !111143504477 - Make TranslatableMarkup slot-ready by wrapping it β (Open) created by idiaz.roncero
- πͺπΈSpain idiaz.roncero Madrid
Submitted MR that I have tested locally and works.
- πΊπΈUnited States smustgrave
Thank you for opening.
Lets add some test coverage for the proposed change.
- πͺπΈSpain idiaz.roncero Madrid
Added test, executed pipeline and it passed.
- πΊπΈUnited States smustgrave
Removing tests tag as the test-only run shows the coverage
1) Drupal\KernelTests\Components\ComponentRenderTest::testRender Drupal\Core\Render\Component\Exception\InvalidComponentDataException: Unable to render component "sdc_test:my-banner". A render array or a scalar is expected for the slot "banner_body" when using the render element with the "#slots" property
Summary seems clear with clear proposal that lines up with the code change.
Code change seems pretty straightforward and see no objection.
LGTM
- π¨πSwitzerland berdir Switzerland
Can confirm that this fixes an issue I see with navigation:title the entity returns a TranslatableMarkup object.
Left one comment on the MR whether this should be expanded to MarkupInterface or even Stringable.
- π¨πSwitzerland berdir Switzerland
Updated, also shortened the test method description, it was already over 80 characters and that made it even longer.
- πΊπΈUnited States smustgrave
1) Drupal\KernelTests\Components\ComponentRenderTest::testRender Drupal\Core\Render\Component\Exception\InvalidComponentDataException: Unable to render component "sdc_test:my-banner". A render array or a scalar is expected for the slot "banner_body" when using the render element with the "#slots" property /builds/issue/drupal-3504477/core/lib/Drupal/Core/Render/Element/ComponentElement.php:118 /builds/issue/drupal-3504477/core/lib/Drupal/Core/Render/Element/ComponentElement.php:65 /builds/issue/drupal-3504477/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php:107 /builds/issue/drupal-3504477/core/lib/Drupal/Core/Render/Renderer.php:830 /builds/issue/drupal-3504477/core/lib/Drupal/Core/Render/Renderer.php:387 /builds/issue/drupal-3504477/core/lib/Drupal/Core/Render/Renderer.php:459 /builds/issue/drupal-3504477/core/lib/Drupal/Core/Render/Renderer.php:203 /builds/issue/drupal-3504477/core/tests/Drupal/KernelTests/Components/ComponentKernelTestBase.php:95 /builds/issue/drupal-3504477/core/lib/Drupal/Core/Render/Renderer.php:593 /builds/issue/drupal-3504477/core/tests/Drupal/KernelTests/Components/ComponentKernelTestBase.php:95 /builds/issue/drupal-3504477/core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php:313 /builds/issue/drupal-3504477/core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php:45 ERRORS!
Shows the test coverage
Believe this would solve a problem I see on my patterns theme were I have to pass #markup => content, in the twig file.
Change makes sense.