Merge pull request #3721 from shubhwebkul/patch-2

Issue #3720 resolved
This commit is contained in:
Jitendra Singh 2020-08-11 16:59:17 +05:30 committed by GitHub
commit e19694b98a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View File

@ -154,7 +154,7 @@
<?php $selectedOption = old('theme') ?: $channel->theme ?>
<select class="control" id="theme" name="theme">
@foreach (themes()->all() as $theme)
@foreach (themes()->getChannelThemes() as $theme)
<option value="{{ $theme->code }}" {{ $selectedOption == $theme->code ? 'selected' : '' }}>
{{ $theme->name }}
</option>

View File

@ -66,6 +66,32 @@ class Themes
return $this->themes;
}
/**
* Return list of registered themes
*
* @return array
*/
public function getChannelThemes()
{
$themes = config('themes.themes', []);
$channelThemes = [];
foreach ($themes as $code => $data) {
$channelThemes[] = new Theme(
$code,
isset($data['name']) ? $data['name'] : '',
isset($data['assets_path']) ? $data['assets_path'] : '',
isset($data['views_path']) ? $data['views_path'] : ''
);
if (isset($data['parent']) && $data['parent']) {
$parentThemes[$code] = $data['parent'];
}
}
return $channelThemes;
}
/**
* Check if specified exists
*