Problem/Motivation

This causes a full 500 Service unavailable and makes the site unusable. The following log entries appear:

Type: php
Message: 	Twig\Error\SyntaxError: Unexpected token "operator" of value "-" ("end of statement block" expected). in Twig\TokenStream->expect() (line 33 of themes/contrib/radix/components/views-view/views-view.twig).
Severity: Error 

Steps to reproduce

Composer to install clean Drupal 10.1.6.
Enable required components (Single Directory Components, Serialization)
Composer to install Radix: composer require 'drupal/radix:^6.0@beta'
Enable the theme and set to default.

Happy to debug on my site if someone wants to lend some guidance on what is needed.

Remaining work

Apply same changes to navbar-brand.twig

Issue fork radix-3404475

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

Gorf created an issue. See original summary.

Gorf’s picture

Issue summary: View changes

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

viren18febs’s picture

Status: Active » Needs review
StatusFileSize
new704 bytes

I have fixed the above issue & added patch, please review.

sandeepsingh199’s picture

Status: Needs review » Needs work
StatusFileSize
new446.5 KB

@viren18febS, I reviewed #4 patch and its throwing other issue.

boinkster’s picture

Getting a similar error, but occuring on form-element.twig:

Twig\Error\SyntaxError: Unexpected token "operator" of value "-" ("end of statement block" expected). in Twig\TokenStream->expect() (line 49 of themes/contrib/radix/components/form-element/form-element.twig).

Following the fix in issue (https://www.drupal.org/project/radix/issues/3402732), in form-element.twig, I tried changing lines 49 and 63 to eliminate the "-". Tried both 'utility_classes' and 'form_element_utility_classes' for 'form-element_utility_classes', it then throws this:

TypeError: Unsupported operand types: null - array in __TwigTemplate_f15449672b5fa3b309636f75db5b3a19->doDisplay() (line 47 of /var/www/html/vendor/twig/twig/src/Environment.php(361) : eval()'d code).

anicoto’s picture

I got the same errors on views_view and navbar_branding, applying the same logic solved my issue.

Use
{% set utility_classes = utility_classes|join(' ') %}

Instead of
{% set navbar-brand_utility_classes = navbar-brand_utility_classes|join(' ') %}

anicoto’s picture

Issue summary: View changes

Adding some remaining-work/next steps

anicoto’s picture

Issue tags: +Novice, +Twigtemplate

Adding tags

amstercad’s picture

Folks following this particular issue are advised to pay attention to this, (currently closed), issue as well: https://www.drupal.org/project/radix/issues/3402732, because everything seems related. Between us, we'll figure things out.

boinkster’s picture

Working though templates with the fix suggested in #7, eventually leads to:

TypeError: Unsupported operand types: null - array in __TwigTemplate_7c900ea4bd68698dd0a963aeeff08683->doDisplay() (line 47 of /var/www/html/vendor/twig/twig/src/Environment.php(361) : eval()'d code).

anicoto’s picture

You need to remove every navbar-brand_ in utility_classes

boinkster’s picture

Still throws the same error after changing every navbar-brand_utility_classes to utility_classes in navbar-brand.twig

doxigo’s picture

This is becoming a mess with the utility_classes, I have two options:
1. Make every utility class of every component named just: utility_classes
2. What we have at the moment (but fix the problem) and name: [component-name]_utility_classes

I wonder if the first option makes more sense here, any pros and cons worth sharing, love to hear what you guys think

boinkster’s picture

I'm new to SDC so don't have knowledge of whether utility_classes everywhere would be an issue down the road.

boinkster’s picture

It's unclear to me what is happening with the twig utility_classes ternary statement and subsequent classes merge. How does a value get passed in to utility_classes and why would you need to?

doxigo’s picture

Status: Needs work » Fixed

Okay thank you all for helping out on this, it was a naming convention issue causing the breakdown. pushed a fix and tagged a new beta3 release.
crediting all

Status: Fixed » Closed (fixed)

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

anicoto’s picture

Awesome @doxigo thanks!

anicoto’s picture