From 21c3571a4832facaf60e0c87ce7c330030305f64 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Thu, 17 Oct 2024 16:36:44 +1100 Subject: [PATCH] Fixes storing an arrays in placeholders Eg: {% put pageTitles = { '0': "Dashboard", '1': "Products", '2': product.name, } %} --- src/Html/BlockBuilder.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Html/BlockBuilder.php b/src/Html/BlockBuilder.php index a46b69528..ec39cdd78 100644 --- a/src/Html/BlockBuilder.php +++ b/src/Html/BlockBuilder.php @@ -3,7 +3,8 @@ use Exception; /** - * BlockBuilder is used for building placeholders and putting content to them + * BlockBuilder is used for building placeholders and putting content to them, + * the content is most often a string, however, it can also store objects. * * @package october\html * @author Alexey Bobkov, Samuel Georges @@ -90,7 +91,7 @@ public function append(string $name, $content) /** * placeholder returns the layout block contents and deletes the block from memory. */ - public function placeholder(string $name, string $default = null): ?string + public function placeholder(string $name, $default = null) { $result = $this->get($name, $default); unset($this->blocks[$name]); @@ -113,13 +114,13 @@ public function has(string $name): bool /** * get returns the layout block contents but not deletes the block from memory */ - public function get(string $name, string $default = null): ?string + public function get(string $name, $default = null) { if (!isset($this->blocks[$name])) { return $default; } - return (string) $this->blocks[$name]; + return $this->blocks[$name]; } /**