Skip to content

Commit 700378a

Browse files
committed
Support custom directives when updating blade templates
This will for example allow overriding the @lang directive to support Gettext based translations.
1 parent ecc2016 commit 700378a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Xinax/LaravelGettext/FileSystem.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php namespace Xinax\LaravelGettext;
22

3+
use Illuminate\Support\Facades\Blade;
34
use RecursiveDirectoryIterator;
45
use RecursiveIteratorIterator;
56
use Xinax\LaravelGettext\Config\Models\Config;
@@ -101,6 +102,9 @@ public function compileViews(array $viewPaths, $domain)
101102
$files = $fs->allFiles($realPath);
102103

103104
$compiler = new \Illuminate\View\Compilers\BladeCompiler($fs, $domainDir);
105+
foreach (Blade::getCustomDirectives() as $directive => $callback) {
106+
$compiler->directive($directive, $callback);
107+
}
104108

105109
foreach ($files as $file) {
106110
$filePath = $file->getRealPath();

0 commit comments

Comments
 (0)