Closed lostcarpark closed 3 weeks ago
Hey @lostcarpark ! Since it's about the code generation module of Drush, do you mind moving your issue into the drupal-code-generator issue queue? I will start a PR right away.
Thanks!
I moved the issue into the drupal-code-generator issue queue : https://github.com/Chi-teck/drupal-code-generator/issues/190
We can close this one.
Describe the bug Running
drush generate sdc
creates a single directory component.Components may contain
props
andslots
.The generator asks if I want to create
props
, but notslots
.props
are correctly added to theprops
section of the component.However, the created component has attempts to use a
slot
called "example_block" without it being defined in theslots
section of the component.yml file. This results in a compiler error when attempting to use the default component.To Reproduce
I ran
drush generate sdc
, selected a theme name and component name, specified no properties, and used defaults for all other options.The generated
.twig
file contains the following:This implements a slot called "example_block". However, as there are no slots defined in the .component.yml file.
When attempting to view the generated component, the use of an undefined slot results in a compile error.
Expected behavior If the default .twig file contains a
{% block %}
, the block should be defined in the .component.yml.The simple fix would be to add the slots section to the .component.yml file.
An even better fix would be to ask about slots after the questions about props, and create a
{% block %}
item for each slot, and a matching entry in .component.yml.Actual behavior The current default component results in a compile error.
Workaround It's fairly simple to fix, either by removing the
block
andendblock
, or by adding theslot
definition. However, it would be great if new users were given a working component out of the box.System Configuration
Additional information None.