Fix Drupal ~10.0 and TWIG ~3.0 Unexpected token name of value if (end of statement block expected)

Created on 2 March 2023, over 1 year ago
Updated 15 October 2023, 12 months ago

Problem/Motivation

The website encountered an unexpected error. Please try again later.

Twig\Error\SyntaxError: Unexpected token "name" of value "if" ("end of statement block" expected). in Twig\TokenStream->expect() (line 135 of modules/contrib/varbase_bootstrap_paragraphs/templates/paragraph--bp-columns-two-uneven.html.twig).

  @javascript @local @development @staging @production
  Scenario: Check if a user with a permission to manage Landing page (Paragraphs) content type can add paragraphs of type Columns Two Uneven
    Given I am a logged in user with the "Site admin" user
    When I go to "/node/add/landing_page"
    And I wait
    And I fill in "Test Landing page Columns (Two Uneven)" for "Title"
    And I fill in "Test Landing page description Columns (Two Uneven)" for "Page description"
    And I wait for AJAX to finish
    And I wait for 1 second
    And I press "Add Component"
    And I wait for AJAX to finish
    And I wait for 1 second
    And I select the "bp_columns_two_uneven" paragraph component
    And I wait for AJAX to finish
    And I select "published" from "edit-moderation-state-0-state"
    And I press the "Save" button
    And I wait
    Then I should see "Landing page (Paragraphs) Test Landing page Columns (Two Uneven) has been created"
      The text "Landing page (Paragraphs) Test Landing page Columns (Two Uneven) has been created" was not found anywhere in the text of the current page. (Behat\Mink\Exception\ResponseTextException)

Proposed resolution

Change the Twig code to work with TWIG ~3.0
Use the following in loops

            {% if key|first != '#' %}
            
            {% endif %}

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Addition/Change/Update/Fix to this project
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ Accessibility and Readability
  • ✅ Code review from 1 Varbase core team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Update Release Notes and Update Helper on new feature change/addition
  • ✅ Release varbase-10.0.0-alpha1 , varbase_bootstrap_paragraphs-10.0.0-alpha1 , varbase-9.0.16 , varbase_bootstrap_paragraphs-9.0.15

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Issue #3345517 : Fixed Drupal ~10.0 and TWIG ~3.0 Unexpected token name of value if (end of statement block expected)
🐛 Bug report
Status

Fixed

Version

10.0

Component

Code

Created by

🇯🇴Jordan Rajab Natshah Jordan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024