- Issue created by @mortona2k
- πΊπΈUnited States markie Albuquerque, NM
+1 on this issue since it causes a WSOD with not much detail on which component is missing the definition. SDC documentation states all props are optional so I imagine most won't define attributes since that's just handed down by default.
- π«π·France just_like_good_vibes PARIS
Hello,
thank you for reporting this issue.
We need more info to be able to help you.
Generally, those errors occur when components are used in an unexpected way.
Would you tell us, which theme and which components are in your site please, and probably which twig syntax is provoking this bug?
thank you very much in advance, - πΊπΈUnited States mortona2k Seattle
I don't know what exactly was causing it. Possibly including a component inside another component without specifying props to pass (inheriting from the current template/component). Possibly not using the attributes array.
It seemed like it was just from having attributes undefined in the component.yml file, but I also have some that don't have it and it's fine.
The problem was causing a whitescreen error.
- π«π·France pdureau Paris
SDC documentation states all props are optional so I imagine most won't define attributes since that's just handed down by default.
All props are optional but an empty
attributes
prop is automatically injected in the template by SDC if missing. - π«π·France pdureau Paris
Possibly including a component inside another component without specifying props to pass (inheriting from the current template/component). Possibly not using the attributes array.
This is not clear. Can you show us how you call the component?
- πΊπΈUnited States mortona2k Seattle
My page SDC:
$schema: https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas...
name: Page
props:
type: object
properties:
page:
type: arraypage.html.twig template, trying to include the component in different ways.
{{ include('unocss_starter:page', with_context = false) }}
or
{% embed 'mantra_starter:page' with {page} only %}
{% endembed %}Either way, it throws the error unless attributes is defined in the page component.
- π«π·France pdureau Paris
Twig's
include
&embed
are not a very good way to embed components, because they don't trigger the SDC render element.Please use
component()
function, provided by UIP2, instead. - πΊπΈUnited States mortona2k Seattle
I see a pattern() function in the docs, is that what you meant?
https://www.drupal.org/docs/contributed-modules/ui-patterns/developer-do... β
- π«π·France pdureau Paris
pattern()
function was for UI Patterns 1.x,component(string $component_id, array $slots = [], array $props = [])
function is for UI Patterns 2.We are planning to update the documentation before Christmas: π¬ Documentation upgrade from v1 to v2 Active
If possible, we also want to trigger the SDC component with
include
&embed
: π [2.0.0-alpha3] Replace component() function by native Twig mechanisms? Active That would be a big win for the entire SDC community, and we will propose a Core fix if it works. - Status changed to Fixed
about 2 months ago 9:34am 9 February 2025