Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294747

SDC incorrectly throws an exception about embedded slots

$
0
0

When building out an example side by side component for experience builder in #3446722: [PP-1] Create an example set of SDC components I encountered an error about missing definitions for slots I was trying to populate in an embedded component. My attempt at embedding the two_column component in the side by side throws the error:

Twig\Error\SyntaxError: An exception has been thrown during the compilation of a template ("We found an unexpected slot that is not declared: [column_one, column_two]. Declare them in "side_by_side.component.yml"."). in Twig\Environment->compileSource() (line 2 of experience_builder_example_components/components/compound/side_by_side/side_by_side.twig).

<div{{ attributes.addClass("bg-"~background) }}>
   ........

  {% embed 'experience_builder_example_components:two_column' %}
    {% block column_one %}
      {% if media_position == "left" %}
        {{ media }}
      {% else %}
        {{ comp_content }}
      {% endif %}
    {% endblock %}

    {% block column_two %}
      {% if media_position == "left" %}
        {{ comp_content }}
      {% else %}
        {{ media }}
      {% endif %}
    {% endblock %}
  {% endembed %}
</div>

This is unexpected because the slots column_one and column_two are defined correctly for the two_column component which means they shouldn't need to be defined in the side_by_side component.

To reproduce this you can install the experience_builder_example_components submodule that is introduced in the MR for #3446722: [PP-1] Create an example set of SDC components . The module automatically places the side_by_side component on the front page of the site which will error out due to this slots issue


Viewing all articles
Browse latest Browse all 294747

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>