Skip to content

Commit

Permalink
Added ability to extend Blade
Browse files Browse the repository at this point in the history
  • Loading branch information
nsrosenqvist committed Mar 14, 2017
1 parent f767b11 commit b904698
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ function __construct($cacheDir = null, array $paths = [])
);
}

function compile($path, $data = [])
function extend($name, callable $handler) {
$this->directive($name, $handler);
}

function directive($name, callable $handler) {
$this->compiler->directive($name, $handler);
}

function compile($path, array $data = [])
{
// If the file can't be found it's probably supplied as a template within
// one of the base directories
Expand All @@ -78,7 +86,7 @@ function compile($path, $data = [])
);
}

function render($path, $data = [])
function render($path, array $data = [])
{
return $this->compile($path, $data)->render();
}
Expand Down

0 comments on commit b904698

Please sign in to comment.