Skip to content
Snippets Groups Projects
Verified Commit f38c94f9 authored by Dave Long's avatar Dave Long
Browse files

Issue #3477373 by finnsky, bbrala, longwave: Fix "Not passing an instance of...

Issue #3477373 by finnsky, bbrala, longwave: Fix "Not passing an instance of "TwigFunction" when creating a function of type "FunctionExpression" is deprecated."

(cherry picked from commit 4b762453)
parent 8b7350e2
Branches
Tags
9 merge requests!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #297772 passed with warnings
Pipeline: drupal

#297816

    Pipeline: drupal

    #297809

      Pipeline: drupal

      #297808

        +6
        ......@@ -64,8 +64,4 @@
        %The "Drupal\\Tests\\Core\\Utility\\MockContainerAware" class implements "Symfony\\Component\\DependencyInjection\\ContainerAwareInterface" that is deprecated since Symfony 6.4, use dependency injection instead.%
        # Twig 3.
        %Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "attach_library" function of type "Twig\\Node\\Expression\\FunctionExpression" is deprecated.%
        %Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "add_component_context" function of type "Twig\\Node\\Expression\\FunctionExpression" is deprecated.%
        %Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "render_var" function of type "Twig\\Node\\Expression\\FunctionExpression" is deprecated.%
        %Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "validate_component_props" function of type "Twig\\Node\\Expression\\FunctionExpression" is deprecated.%
        %Since twig/twig 3.12: Twig Filter "spaceless" is deprecated%
        ......@@ -9,6 +9,7 @@
        use Drupal\Core\Render\Component\Exception\InvalidComponentException;
        use Drupal\Core\Theme\ComponentPluginManager;
        use Twig\Environment;
        use Twig\TwigFunction;
        use Twig\Node\Expression\ConstantExpression;
        use Twig\Node\Expression\FunctionExpression;
        use Twig\Node\ModuleNode;
        ......@@ -55,17 +56,17 @@ public function leaveNode(Node $node, Environment $env): ?Node {
        $print_nodes[] = new PrintNode(new ConstantExpression(sprintf('<!-- %s Component start: %s -->', $emoji, $component_id), $line), $line);
        }
        $print_nodes[] = new PrintNode(new FunctionExpression(
        'attach_library',
        new TwigFunction('attach_library', [$env->getExtension(TwigExtension::class), 'attachLibrary']),
        new Node([new ConstantExpression($component->getLibraryName(), $line)]),
        $line
        ), $line);
        $print_nodes[] = new PrintNode(new FunctionExpression(
        'add_component_context',
        new TwigFunction('add_component_context', [$env->getExtension(ComponentsTwigExtension::class), 'addAdditionalContext'], ['needs_context' => TRUE]),
        new Node([new ConstantExpression($component_id, $line)]),
        $line
        ), $line);
        $print_nodes[] = new PrintNode(new FunctionExpression(
        'validate_component_props',
        new TwigFunction('validate_component_props', [$env->getExtension(ComponentsTwigExtension::class), 'validateProps'], ['needs_context' => TRUE]),
        new Node([new ConstantExpression($component_id, $line)]),
        $line
        ), $line);
        ......
        ......@@ -3,6 +3,7 @@
        namespace Drupal\Core\Template;
        use Twig\Environment;
        use Twig\TwigFunction;
        use Twig\Node\Expression\FilterExpression;
        use Twig\Node\Expression\FunctionExpression;
        use Twig\Node\Node;
        ......@@ -47,7 +48,11 @@ public function leaveNode(Node $node, Environment $env): ?Node {
        $class = get_class($node);
        $line = $node->getTemplateLine();
        return new $class(
        new FunctionExpression('render_var', new Node([$node->getNode('expr')]), $line),
        new FunctionExpression(
        new TwigFunction('render_var', [$env->getExtension(TwigExtension::class), 'renderVar']),
        new Node([$node->getNode('expr')]),
        $line
        ),
        $line
        );
        }
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment