-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Twig 2 upgrade (Drupal 9 compatibility) #2258
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can't patch dependency versions with a composer patch, so this never actually worked. See https://github.com/cweagans/composer-patches#patching-composerjson-in-dependencies
Dot notation does some fancy magic behind the scenes. Read more here: https://twig.symfony.com/doc/2.x/templates.html Something that was added in Twig 2.x, when using foo.bar, it will check for a `hasBar` method on the underlying object if `bar` is not a property of it. In this case, `hasClass` is a method, but not one we intend to ever call. This syntax makes that clear to twig, I think.
See https://twig.symfony.com/doc/1.x/deprecated.html#macros > As of Twig 2.0, macros imported in a file are not available in child > templates anymore (via an include call for instance). You need to > import macros explicitly in each file where you are using them.
…g 2.x" This reverts commit 875f426b0d7557e583ea8469bf81dd4fd0f8bb7c.
The implemented/extended classes here were deprecated well before this code was originally written in 2018, in #426. In any case, \Twig\Extension\GlobalsInterface is needed to for the getGlobals() method to work now. See https://twig.symfony.com/doc/2.x/advanced.html
basaltinc/twig-tools should use the master branch of our fork at https://github.com/boltdesignsystem/twig-tools. Updated last in boltdesignsystem/twig-tools#1 bolt-design-system/core-php should use the latest version of that project which will be deployed to https://github.com/boltdesignsystem/core-php (and packagist) when this branch is included in a Bolt release. It's annoying circular; we can't actually test that until we cut the release.
These changes are copied from this commit in the read-only repo, that was done temporarily while testing: boltdesignsystem/bolt_connect@fe5e99d
' Conflicts: ' packages/testing/testing-helpers/package.json ' packages/twig-integration/drupal-module/composer.json ' packages/twig-integration/twig-renderer/package.json
…olt into feature/DS-489-twig-2
colbytcook
approved these changes
Sep 24, 2021
@remydenton approved, I did not notice any regressions with these changes.
|
danielamorse
approved these changes
Sep 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Reviewed the code as much as I could. See just what I'd expect to see here.
- Spot-checked PL and everything looks good.
- Checked out this branch and got twig 2 installed on the first
yarn clean && yarn setup
. Perhaps it worked for me because I'd already cleared cache previously.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira
https://pegadigitalit.atlassian.net/browse/DS-489
Summary
Updates pattern Lab to twig 2.0 for compatibility with Drupal 9
Details
How to test
vendor
directory (vendor/twig/twig
), version 2.x is being used. The quickest way to do this is by looking atvendor/twig/twig/CHANGELOG
and confirming the latest lines references twig 2.14.Release notes
Support for twig 2 added.