Skip to content

Commit

Permalink
🩹 Check if template is an array before handling (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored Jul 16, 2024
1 parent 6f26046 commit 8d08e3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ abstract class Block extends Composer implements BlockContract
/**
* The block template.
*
* @var array
* @var array|string
*/
public $template = [];

Expand Down Expand Up @@ -594,7 +594,9 @@ public function render($block, $content = '', $preview = false, $post_id = 0, $w

$this->post = get_post($post_id);

$this->template = $this->handleTemplate($this->template)->toJson();
$this->template = is_array($this->template)
? $this->handleTemplate($this->template)->toJson()
: $this->template;

$this->classes = $this->getClasses();
$this->style = $this->getStyle();
Expand Down

0 comments on commit 8d08e3d

Please sign in to comment.