- Issue created by @pdureau
- First commit to issue fork.
As a follow-up of 🐛 SDC components: Fix JSON schema usage Fixed , here are some feedbacks done with https://www.drupal.org/project/sdc_devel → which is providing a drush command and a report page to audit SDC components.
Every slot or prop from the component definition must be used in templates.
Default attributes
object is not always defined in the YAML, but always injected in template and expected for alteration (adding contextual accessibility attributes, adding data for site building tools, style overrides of the component...).
$ vendor/bin/drush sdcv --install prototype | grep "Unused variables:"
[notice] Start validation of prototype...
menu-tabs Unused variables: attributes
back-to-top Unused variables: attributes
search-bar Unused variables: attributes, form_action, form_children
slideshow Unused variables: index_id, title
icons Unused variables: attributes
Every slot or prop used in the template must be found in the component definition (except the ones automatically injected: attributes
, componentMetadata
...)
$ vendor/bin/drush sdcv --install prototype | grep "Unknown variable:"
[notice] Start validation of prototype...
search-bar Unknown variable: `button_text`. 12 {{ button_text|default('Expand Search') }}
search-bar Unknown variable: `button_text`. 12 {{ button_text|default('Expand Search') }}
search-bar Unknown variable: `content`. 16 {{content}}
slideshow Unknown variable: `options`. 26 {% set data_splide = options|default({})|merge(default_options) %}
slideshow Unknown variable: `options`. 26 {% set data_splide = options|default({})|merge(default_options) %}
slideshow Unknown variable: `heading`. 30 <h2 id="{{label_id}}" class="c-slideshow__heading visually-hidden">{{
slideshow Unknown variable: `heading`. 30 <h2 id="{{label_id}}" class="c-slideshow__heading visually-hidden">{{
slideshow Unknown variable: `slides`. 34 {% for slide in slides %}
menu Unknown variable: `classes`. 2 'class': ['c-menu']|merge(classes|default([])),
menu Unknown variable: `classes`. 2 'class': ['c-menu']|merge(classes|default([])),
menu Unknown variable: `menu_name`. 19 {{ menus.menu_links(items, attributes.addClass('c-menu__list'), 0, menu_name) }}
menu Unknown variable: `classes`. 25 <li {{ item.attributes.addClass(classes) }}>
drupal-messages Unknown variable: `status_headings`. 10 <div role='contentinfo' aria-label="{{ status_headings[type] }}" {{
drupal-messages Unknown variable: `status_headings`. 15 {% if status_headings[type] %}
drupal-messages Unknown variable: `status_headings`. 16 <h2 class='visually-hidden'>{{ status_headings[type] }}</h2>
sidebar Unknown variable: `class`. 2 <aside{{attributes.addClass(class)}} role='complementary'>
Empty objects are not enough to be understood and processed by display builders ( UI Patterns 2 → , the upcoming Experience Builder...):
$ vendor/bin/drush sdcv --install prototype | grep "Empty array"
[notice] Start validation of prototype...
teaser Empty array. 23 media:
pager Empty array. 11 items:
pager Empty array. 14 ellipses:
tabs-content Empty array. 14 items:
Active
5.2
Code