add filters for head and foot composers
This commit is contained in:
parent
d86bdd22d9
commit
ba251beeca
|
|
@ -4,6 +4,7 @@ namespace App\Http\View\Composers;
|
||||||
|
|
||||||
use App\Services\Translations\JavaScript;
|
use App\Services\Translations\JavaScript;
|
||||||
use App\Services\Webpack;
|
use App\Services\Webpack;
|
||||||
|
use Blessing\Filter;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
@ -23,6 +24,9 @@ class FootComposer
|
||||||
/** @var Dispatcher */
|
/** @var Dispatcher */
|
||||||
protected $dispatcher;
|
protected $dispatcher;
|
||||||
|
|
||||||
|
/** @var Filter */
|
||||||
|
protected $filter;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Request $request,
|
Request $request,
|
||||||
Webpack $webpack,
|
Webpack $webpack,
|
||||||
|
|
@ -87,6 +91,8 @@ class FootComposer
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scripts = $this->filter->apply('scripts', $scripts);
|
||||||
|
|
||||||
$view->with([
|
$view->with([
|
||||||
'scripts' => $scripts,
|
'scripts' => $scripts,
|
||||||
'inline_js' => option('custom_js'),
|
'inline_js' => option('custom_js'),
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Http\View\Composers;
|
namespace App\Http\View\Composers;
|
||||||
|
|
||||||
use App\Services\Webpack;
|
use App\Services\Webpack;
|
||||||
|
use Blessing\Filter;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
|
@ -20,14 +21,19 @@ class HeadComposer
|
||||||
/** @var Request */
|
/** @var Request */
|
||||||
protected $request;
|
protected $request;
|
||||||
|
|
||||||
|
/** @var Filter */
|
||||||
|
protected $filter;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Webpack $webpack,
|
Webpack $webpack,
|
||||||
Dispatcher $dispatcher,
|
Dispatcher $dispatcher,
|
||||||
Request $request
|
Request $request,
|
||||||
|
Filter $filter
|
||||||
) {
|
) {
|
||||||
$this->webpack = $webpack;
|
$this->webpack = $webpack;
|
||||||
$this->dispatcher = $dispatcher;
|
$this->dispatcher = $dispatcher;
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
|
$this->filter = $filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function compose(View $view)
|
public function compose(View $view)
|
||||||
|
|
@ -113,6 +119,7 @@ class HeadComposer
|
||||||
'crossorigin' => 'anonymous',
|
'crossorigin' => 'anonymous',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
$links = $this->filter->apply('head_links', $links);
|
||||||
$view->with('links', $links);
|
$view->with('links', $links);
|
||||||
$view->with('inline_css', option('custom_css'));
|
$view->with('inline_css', option('custom_css'));
|
||||||
$view->with('custom_cdn_host', option('cdn_address'));
|
$view->with('custom_cdn_host', option('cdn_address'));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user