Unverified Commit 134cf9f7 authored by Alex Pott's avatar Alex Pott
Browse files

feat: #3559156 Support Twig's CVA function

By: phenaproxima
By: longwave
By: alexpott
parent 5612209a
Loading
Loading
Loading
Loading
Loading
+70 −1
Original line number Diff line number Diff line
@@ -368,7 +368,7 @@
            "dist": {
                "type": "path",
                "url": "core",
                "reference": "f69c5d48bb8c7b6d698686eb6c9cccb3c138c3ed"
                "reference": "3a46eee48869daf39ae2bf07f79e6bf13fcf18aa"
            },
            "require": {
                "asm89/stack-cors": "^2.3",
@@ -420,6 +420,7 @@
                "symfony/serializer": "^7.4",
                "symfony/validator": "^7.4",
                "symfony/yaml": "^7.4",
                "twig/html-extra": "^3.23",
                "twig/twig": "^3.21.0"
            },
            "conflict": {
@@ -4762,6 +4763,74 @@
            ],
            "time": "2025-11-16T10:14:42+00:00"
        },
        {
            "name": "twig/html-extra",
            "version": "v3.24.0",
            "source": {
                "type": "git",
                "url": "https://github.com/twigphp/html-extra.git",
                "reference": "313900fb98b371b006a55b1a29241a192634be13"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/twigphp/html-extra/zipball/313900fb98b371b006a55b1a29241a192634be13",
                "reference": "313900fb98b371b006a55b1a29241a192634be13",
                "shasum": ""
            },
            "require": {
                "php": ">=8.1.0",
                "symfony/deprecation-contracts": "^2.5|^3",
                "symfony/mime": "^5.4|^6.4|^7.0|^8.0",
                "twig/twig": "^3.13|^4.0"
            },
            "require-dev": {
                "symfony/phpunit-bridge": "^6.4|^7.0"
            },
            "type": "library",
            "autoload": {
                "files": [
                    "Resources/functions.php"
                ],
                "psr-4": {
                    "Twig\\Extra\\Html\\": ""
                },
                "exclude-from-classmap": [
                    "/Tests/"
                ]
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Fabien Potencier",
                    "email": "fabien@symfony.com",
                    "homepage": "http://fabien.potencier.org",
                    "role": "Lead Developer"
                }
            ],
            "description": "A Twig extension for HTML",
            "homepage": "https://twig.symfony.com",
            "keywords": [
                "html",
                "twig"
            ],
            "support": {
                "source": "https://github.com/twigphp/html-extra/tree/v3.24.0"
            },
            "funding": [
                {
                    "url": "https://github.com/fabpot",
                    "type": "github"
                },
                {
                    "url": "https://tidelift.com/funding/github/packagist/twig/twig",
                    "type": "tidelift"
                }
            ],
            "time": "2026-03-17T07:24:08+00:00"
        },
        {
            "name": "twig/twig",
            "version": "v3.22.0",
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@
        "symfony/var-dumper": "~v7.4.0",
        "symfony/var-exporter": "~v7.4.0",
        "symfony/yaml": "~v7.4.0",
        "twig/html-extra": "~v3.24.0",
        "twig/twig": "~v3.22.0"
    },
    "extra": {
+2 −1
Original line number Diff line number Diff line
@@ -53,7 +53,8 @@
        "mck89/peast": "^1.17.4",
        "sebastian/diff": "^4 || ^5 || ^6 || ^7",
        "php-tuf/composer-stager": "^2.0",
        "justinrainbow/json-schema": "^5.2 || ^6.5.2"
        "justinrainbow/json-schema": "^5.2 || ^6.5.2",
        "twig/html-extra": "^3.23"
    },
    "conflict": {
        "drupal/automatic_updates": "<4",
+3 −0
Original line number Diff line number Diff line
@@ -1827,6 +1827,9 @@ services:
    arguments: ['@plugin.manager.sdc', '@Drupal\Core\Theme\Component\ComponentValidator']
    tags:
      - { name: twig.extension, priority: 101 }
  Twig\Extra\Html\HtmlExtension:
    tags:
      - { name: twig.extension, priority: 101 }
  Drupal\Core\Template\IconsTwigExtension:
    arguments: ['@plugin.manager.icon_pack']
    tags:
+3 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@

use Drupal\Core\Site\Settings;
use Drupal\Core\Template\Attribute\TwigAllowed;
use Twig\Extra\Html\Cva;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityPolicyInterface;

@@ -54,6 +55,8 @@ public function __construct() {
      // Allow any operations on the Attribute object as it is intended to be
      // changed from a Twig template, for example calling addClass().
      'Drupal\Core\Template\Attribute',
      // The CVA class's only public method is meant to be called by templates.
      Cva::class,
    ]);
    // Flip the array so we can check using isset().
    $this->allowed_classes = array_flip($allowed_classes);
Loading