Skip to content

Commit

Permalink
Merge pull request #5 from Log1x/next
Browse files Browse the repository at this point in the history
- Make $block an object
- Give access to $this->block in controller
  • Loading branch information
Log1x authored Dec 16, 2019
2 parents c055158 + 8e6f33a commit 9d146d4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ abstract class Block
*/
protected $prefix = 'acf/';

/**
* The block properties.
*
* @var array
*/
protected $block;

/**
* Create a new ACF Composer Block instance.
*
Expand Down Expand Up @@ -209,8 +216,10 @@ protected function uri($path = '')
*/
public function view($block)
{
$this->block = (object) $block;

if (file_exists($view = $this->app->resourcePath("views/blocks/{$this->slug}.blade.php"))) {
echo view($view, array_merge(['block' => $block], $this->with()));
echo view($view, array_merge($this->with(), ['block' => $this->block]));
} elseif (file_exists($notFound = $this->app->resourcePath('views/blocks/view-404.blade.php'))) {
echo view($notFound, ['view' => $view]);
} else {
Expand Down

0 comments on commit 9d146d4

Please sign in to comment.