Skip to content

Commit

Permalink
[resources/views]: Support explicit plugin deactivation when active b…
Browse files Browse the repository at this point in the history
…y default. (#1139)
  • Loading branch information
dfsmania authored Dec 7, 2022
1 parent e9b6d9c commit 31fd44f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions resources/views/plugins.blade.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
@foreach(config('adminlte.plugins') as $pluginName => $plugin)
@if($plugin['active'] || View::getSection('plugins.' . ($plugin['name'] ?? $pluginName)))

{{-- Check whether the plugin is active --}}

@php
$plugSection = View::getSection('plugins.' . ($plugin['name'] ?? $pluginName));
$isPlugActive = $plugin['active']
? ! isset($plugSection) || $plugSection
: ! empty($plugSection);
@endphp

{{-- When the plugin is active, include its files --}}

@if($isPlugActive)
@foreach($plugin['files'] as $file)

{{-- Setup the file location --}}
{{-- Setup the file location --}}

@php
if (! empty($file['asset'])) {
$file['location'] = asset($file['location']);
}
@endphp

{{-- Check requested file type --}}
{{-- Check the requested file type --}}

@if($file['type'] == $type && $type == 'css')
<link rel="stylesheet" href="{{ $file['location'] }}">
@elseif($file['type'] == $type && $type == 'js')
Expand All @@ -18,4 +32,5 @@

@endforeach
@endif

@endforeach

0 comments on commit 31fd44f

Please sign in to comment.