Skip to content
Snippets Groups Projects
Verified Commit 7a6c0a55 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 193eca89
Branches
Tags
10 merge requests!12802Issue #3537193 by opauwlo: Add enable absolute path option for CKEditor5 image uploads,!12745Fixed: Path alias language doesn't changes on changing of node language,!12684Issue #3220784,!12537Add ViewsConfigUpdater deprecation support for default_argument_skip_url,!12523Issue #3493858 by vidorado, xavier.masson, smustgrave: Extend ViewsBlockBase...,!122353526426-warning-for-missing,!11958Issue #3490507 by alexpott, smustgrave: Fix bogus mocking in...,!11769Issue #3517987: Add option to contextual filters to encode slashes in query parameter.,!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!9944Issue #3483353: Consider making the createCopy config action optionally fail...
Pipeline #296754 passed with warnings
Pipeline: drupal

#296765

    Pipeline: drupal

    #296758

      ......@@ -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