File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
src/Illuminate/View/Compilers Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ class BladeCompiler extends Compiler implements CompilerInterface
56
56
*/
57
57
protected $ conditions = [];
58
58
59
+ /**
60
+ * The registered string preparation callbacks.
61
+ *
62
+ * @var array
63
+ */
64
+ protected $ prepareStringsForCompilationUsing = [];
65
+
59
66
/**
60
67
* All of the registered precompilers.
61
68
*
@@ -249,6 +256,10 @@ public function compileString($value)
249
256
{
250
257
[$ this ->footer , $ result ] = [[], '' ];
251
258
259
+ foreach ($ this ->prepareStringsForCompilationUsing as $ callback ) {
260
+ $ value = $ callback ($ value );
261
+ }
262
+
252
263
// First we will compile the Blade component tags. This is a precompile style
253
264
// step which compiles the component Blade tags into @component directives
254
265
// that may be used by Blade. Then we should call any other precompilers.
@@ -947,6 +958,19 @@ public function getCustomDirectives()
947
958
return $ this ->customDirectives ;
948
959
}
949
960
961
+ /**
962
+ * Indicate that the following callable should be used to prepare strings for compilation.
963
+ *
964
+ * @param callable $callback
965
+ * @return $this
966
+ */
967
+ public function prepareStringsForCompilationUsing (callable $ callback )
968
+ {
969
+ $ this ->prepareStringsForCompilationUsing [] = $ callback ;
970
+
971
+ return $ this ;
972
+ }
973
+
950
974
/**
951
975
* Register a new precompiler.
952
976
*
You can’t perform that action at this time.
0 commit comments