Skip to content

Commit 13789f7

Browse files
author
matheo
committed
destruct properties
1 parent 82d9a9f commit 13789f7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/TwigComponent/src/ComponentRenderer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ private function exposedVariables(object $component, bool $exposePublicProps): \
131131
/** @var ExposeInTemplate $attribute */
132132
$value = $attribute->getter ? $component->{rtrim($attribute->getter, '()')}() : $this->propertyAccessor->getValue($component, $property->name);
133133

134+
if ($attribute->destruct) {
135+
foreach ($value as $key => $destructedValue) {
136+
yield $key => $destructedValue;
137+
}
138+
}
139+
134140
yield $attribute->name ?? $property->name => $value;
135141
}
136142

0 commit comments

Comments
 (0)