Problem/Motivation

Currently the following deprecation notice is thrown for ui_patterns code:

Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "_ui_patterns_preprocess_props" function of type "Twig\Node\Expression\FunctionExpression" is deprecated.

See also https://git.drupalcode.org/project/drupal/-/commit/f38c94f9b624a6828313c... for how this issue was fixed for SDC's ComponentNodeVisitor.

Steps to reproduce

  • Perform UI patterns related kernel tests with Symfony deprecation helper enabled and see the above mentioned deprecation notice

Proposed resolution

  • Use TwigFunction instead of passing a string to FunctionExpression

Remaining tasks

  • Create issue fork an MR to fix this issue

User interface changes

n/a

API changes

n/a

Data model changes

n/a

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

hctom created an issue. See original summary.

hctom’s picture

Assigned: hctom » Unassigned
Status: Active » Needs review

See the associated issue fork and MR for the fix.

hctom’s picture

Issue summary: View changes

Typos and issue summary update

pdureau’s picture

Title: Since twig/twig 3.12: Not passing an instance of "TwigFunction" is deprecated » [2.0.0-beta5] Since twig/twig 3.12: Not passing an instance of "TwigFunction" is deprecated

Thanks a lot.

Drupal Core's Twig dependency:

At the 2.0.0 release, we will support Drupal 10.3, 11.0 & 11.1. So we need to be careful about nor breaking stuff.

Target: Beta5. But we can target Beta4 (released this week) if we are sure backward dependency.

hctom’s picture

Just checked drupal/core-recommended for the recommended Twig versions, and from 10.3.4 on, twig/twig is required with ~3.14.0 (https://github.com/drupal/core-recommended/blob/10.3.4/composer.json).

Ist it worth to support 10.3.x core versions below 10.3.4 or should the core_version_requirement of UI Patterns be changed to ^10.3.4 || ^11 instead?

pdureau’s picture

Title: [2.0.0-beta5] Since twig/twig 3.12: Not passing an instance of "TwigFunction" is deprecated » [2.0.0-beta4] Compatibility with Twig 3.12: Not passing an instance of "TwigFunction" is deprecated
hctom’s picture

As discussed with @pdureau in Slack, increasing the core version requirement for Drupal 10 to ^10.3.4 is enough, because the latest 10.3.x version will be targeted.

Issue fork and MR are also updated with the corresponding commit.

  • pdureau committed 89c44b0c on 2.0.x authored by hctom
    Issue #3483939 by hctom: Compatibility with Twig 3.12
    
pdureau’s picture

Status: Needs review » Fixed
pdureau’s picture

Status: Fixed » Closed (fixed)