From 2c63a81660a2c0c012c4127a863935ff43b9613d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=BCsges?= Date: Wed, 12 Feb 2020 07:56:06 +0100 Subject: [PATCH 1/2] Fix default slot --- src/Compiler.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Compiler.php b/src/Compiler.php index 6b8c33d..2077dc2 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -182,11 +182,16 @@ public function convertNode(DOMNode $node, int $level = 0): DOMNode } } + foreach (iterator_to_array($node->childNodes) as $childNode) { + $this->convertNode($childNode, $level + 1); + } + /* * Slots (Default) */ if ($node->hasChildNodes()) { $innerHtml = $this->innerHtmlOfNode($node); + $innerHtml = $this->replacePlaceholders($innerHtml); $this->logger->debug('Add default slot:', [ 'nodeValue' => $node->nodeValue, 'innerHtml' => $innerHtml, From 1287e4d8dab02291c728f50d706f826d61cc66bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=BCsges?= Date: Wed, 12 Feb 2020 08:01:14 +0100 Subject: [PATCH 2/2] Update test for default slot --- .../vue-slot/include-child-component-with-default-slot.twig | 4 +++- .../vue-slot/include-child-component-with-default-slot.vue | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/fixtures/vue-slot/include-child-component-with-default-slot.twig b/tests/fixtures/vue-slot/include-child-component-with-default-slot.twig index 85c1e8f..fb07fd7 100644 --- a/tests/fixtures/vue-slot/include-child-component-with-default-slot.twig +++ b/tests/fixtures/vue-slot/include-child-component-with-default-slot.twig @@ -1,7 +1,9 @@
{% set slot_default_value %}

My default slot title

-

some text

+ {% if true %} +

some text

+ {% endif %} {% endset %} {% include "/templates/ChildComponent.twig" with { 'slot_default': slot_default_value, 'class': "" } %}
diff --git a/tests/fixtures/vue-slot/include-child-component-with-default-slot.vue b/tests/fixtures/vue-slot/include-child-component-with-default-slot.vue index 94e8a93..4985487 100644 --- a/tests/fixtures/vue-slot/include-child-component-with-default-slot.vue +++ b/tests/fixtures/vue-slot/include-child-component-with-default-slot.vue @@ -2,7 +2,7 @@

My default slot title

-

some text

+

some text