Skip to content

Commit

Permalink
Fixes storing an arrays in placeholders
Browse files Browse the repository at this point in the history
Eg:

{% put pageTitles = {
      '0':  "Dashboard",
      '1':  "Products",
      '2':  product.name,
    }
%}
  • Loading branch information
daftspunk committed Oct 17, 2024
1 parent 61e32e1 commit 6b9e631
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Html/BlockBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]);
Expand All @@ -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];
}

/**
Expand Down

0 comments on commit 6b9e631

Please sign in to comment.