File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ class Builder
6262
6363 protected array $ additionalScripts = [];
6464
65+ protected array $ templateData = [];
66+
6567 public function __construct (public Repository $ config , public Factory $ view , public HtmlBuilder $ html )
6668 {
6769 /** @var array $defaults */
@@ -158,7 +160,13 @@ protected function template(): string
158160
159161 $ template = $ this ->template ?: $ configTemplate ;
160162
161- return $ this ->view ->make ($ template , ['editors ' => $ this ->editors , 'scripts ' => $ this ->additionalScripts ])->render ();
163+ return $ this ->view ->make (
164+ $ template ,
165+ array_merge (
166+ ['editors ' => $ this ->editors , 'scripts ' => $ this ->additionalScripts ],
167+ $ this ->templateData ,
168+ )
169+ )->render ();
162170 }
163171
164172 /**
@@ -263,4 +271,15 @@ public function addScript(string $view): static
263271
264272 return $ this ;
265273 }
274+
275+ public function templateData (array |\Closure $ data = []): static
276+ {
277+ if ($ data instanceof \Closure) {
278+ $ data = $ data ($ this ) ?? [];
279+ }
280+
281+ $ this ->templateData = $ data ;
282+
283+ return $ this ;
284+ }
266285}
You can’t perform that action at this time.
0 commit comments