51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Support\HtmlString;
|
|
use Modules\Stylist\Html\ThemeHtmlBuilder;
|
|
use Modules\Stylist\Theme\Stylist;
|
|
use Modules\Stylist\Theme\UrlGenerator;
|
|
use Modules\Stylist\View\ThemeViewResolver;
|
|
|
|
if (! function_exists('stylist')) {
|
|
function stylist(): Stylist
|
|
{
|
|
return app(Stylist::class);
|
|
}
|
|
}
|
|
|
|
if (! function_exists('stylist_html')) {
|
|
function stylist_html(): ThemeHtmlBuilder
|
|
{
|
|
return app(ThemeHtmlBuilder::class);
|
|
}
|
|
}
|
|
|
|
if (! function_exists('stylist_view')) {
|
|
function stylist_view(string $view, array $data = [], array $mergeData = []): View
|
|
{
|
|
return app(ThemeViewResolver::class)->make($view, $data, $mergeData);
|
|
}
|
|
}
|
|
|
|
if (! function_exists('stylist_theme_view')) {
|
|
function stylist_theme_view(string $theme, string $view, array $data = [], array $mergeData = []): View
|
|
{
|
|
return app(ThemeViewResolver::class)->makeForTheme($theme, $view, $data, $mergeData);
|
|
}
|
|
}
|
|
|
|
if (! function_exists('theme_asset')) {
|
|
function theme_asset(string $path): string
|
|
{
|
|
return app(UrlGenerator::class)->asset($path);
|
|
}
|
|
}
|
|
|
|
if (! function_exists('theme_switcher')) {
|
|
function theme_switcher(): HtmlString
|
|
{
|
|
return stylist_html()->switcher();
|
|
}
|
|
}
|