From 4b0885f7d675922659187cbbafbe6fbb6a159676 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 22 Feb 2023 13:01:34 +0100 Subject: [PATCH] Made the configuration block tabs accessible --- src/Directive/ConfigurationBlockDirective.php | 1 + .../html/directives/configuration-block.html.twig | 12 +++++++----- .../blocks/directives/configuration-block.html | 14 ++++++++------ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/Directive/ConfigurationBlockDirective.php b/src/Directive/ConfigurationBlockDirective.php index 3a999435..8b0c8cb9 100644 --- a/src/Directive/ConfigurationBlockDirective.php +++ b/src/Directive/ConfigurationBlockDirective.php @@ -54,6 +54,7 @@ public function processSub(Parser $parser, ?Node $document, string $variable, st $language = $node->getLanguage() ?? 'Unknown'; $blocks[] = [ + 'hash' => hash('sha1', $node->getValue()), 'language_label' => self::LANGUAGE_LABELS[$language] ?? ucfirst(str_replace('-', ' ', $language)), 'language' => $language, 'code' => $node->render(), diff --git a/src/Templates/default/html/directives/configuration-block.html.twig b/src/Templates/default/html/directives/configuration-block.html.twig index 4917382e..03a48d3e 100644 --- a/src/Templates/default/html/directives/configuration-block.html.twig +++ b/src/Templates/default/html/directives/configuration-block.html.twig @@ -1,14 +1,16 @@
- +
{% for block in blocks %} -
+
{{ block.code|raw }}
{% endfor %} diff --git a/tests/fixtures/expected/blocks/directives/configuration-block.html b/tests/fixtures/expected/blocks/directives/configuration-block.html index bdff934b..4b940ce5 100644 --- a/tests/fixtures/expected/blocks/directives/configuration-block.html +++ b/tests/fixtures/expected/blocks/directives/configuration-block.html @@ -1,9 +1,10 @@
-
    -
  • YAML
  • -
  • PHP
  • -
-
+
+ + +
+ +
1
@@ -11,7 +12,8 @@
-