From 1caa79e6b3d1eacd7c4c78e571ef42248a03379f Mon Sep 17 00:00:00 2001 From: Jacob Dreesen Date: Wed, 30 Oct 2024 15:25:34 +0100 Subject: [PATCH] chore: remove unnecessary custom `any` twig filter --- config/services.yaml | 2 -- src/Twig/NeustaExtension.php | 32 ----------------------------- templates/bricks/overview.html.twig | 6 +++--- 3 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 src/Twig/NeustaExtension.php diff --git a/config/services.yaml b/config/services.yaml index c69769d..d99dcfa 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -18,5 +18,3 @@ services: tags: - { name: kernel.event_listener, event: pimcore.bundle_manager.paths.css, method: addCSSFiles } - { name: kernel.event_listener, event: pimcore.bundle_manager.paths.js, method: addJSFiles } - - Neusta\Pimcore\AreabrickConfigBundle\Twig\NeustaExtension: ~ diff --git a/src/Twig/NeustaExtension.php b/src/Twig/NeustaExtension.php deleted file mode 100644 index 9dfb29f..0000000 --- a/src/Twig/NeustaExtension.php +++ /dev/null @@ -1,32 +0,0 @@ - $array - */ - private static function any(iterable $array, callable $arrow): bool - { - foreach ($array as $k => $v) { - if ($arrow($v, $k)) { - return true; - } - } - - return false; - } -} diff --git a/templates/bricks/overview.html.twig b/templates/bricks/overview.html.twig index f6ce37f..34d8aaf 100644 --- a/templates/bricks/overview.html.twig +++ b/templates/bricks/overview.html.twig @@ -1,6 +1,6 @@ -{% set hasVersions = bricks|any(b => b.version is not empty) %} -{% set hasDescriptions = bricks|any(b => b.description is not empty) %} -{% set hasAdditionalProperties = bricks|any(b => b.additionalProperties is not empty) %} +{% set hasVersions = bricks has some brick => brick.version is not empty %} +{% set hasDescriptions = bricks has some brick => brick.description is not empty %} +{% set hasAdditionalProperties = bricks has some brick => brick.additionalProperties is not empty %}