Problem/Motivation

When defining arguments for a SPA/Twig block, the argument name is inserted directly into the Twig template.
If the argument name contains a dash (-) instead of underscore (_), Twig cannot parse the variable and the template will not render.

This is confusing for site builders because the UI does not warn them, and the error only shows up when rendering.

Steps to reproduce

Create a new SPA.

Add an argument with the name my-argument-name.

Use it in the Twig template:

Test: {{ my-argument-name }}

Save and render.

Proposed resolution

Add a link to Twig documentation in the twig template help text.

Issue fork spa-3541845

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gashunk created an issue. See original summary.

gashunk’s picture

Issue summary: View changes
gashunk’s picture

gashunk’s picture

Component: Documentation » User interface
Status: Active » Needs review
harlor’s picture

Status: Needs review » Needs work
gashunk’s picture

Status: Needs work » Needs review

Add argument name validation and checked the uniqueness of the SpaArguments.

hydra made their first commit to this issue’s fork.

hydra’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.