Method Added For Fetching Channel Name
This commit is contained in:
parent
f8f432058e
commit
df6e890dfe
|
|
@ -14,7 +14,7 @@
|
|||
<select class="control" name="channels[]" v-validate="'required'" data-vv-as=""{{ __('admin::app.catalog.products.channel') }}"" multiple>
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->code, $productChannels) ? 'selected' : ''}}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
<option
|
||||
value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channelModel) }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
<select type="text" class="control" name="channels[]" v-validate="'required'" value="{{ old('channel[]') }}" data-vv-as=""{{ __('admin::app.cms.pages.channel') }}"" multiple="multiple">
|
||||
@foreach($channels->all() as $channel)
|
||||
<option value="{{ $channel->id }}">{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}</option>
|
||||
<option value="{{ $channel->id }}">{{ core()->getChannelName($channel) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
<select type="text" class="control" name="channels[]" v-validate="'required'" value="{{ old('channel[]') }}" data-vv-as=""{{ __('admin::app.cms.pages.channel') }}"" multiple="multiple">
|
||||
@foreach(app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
@foreach (core()->getAllChannels() as $channelModel)
|
||||
|
||||
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
<select v-validate="'required'" class="control" id="channel_id" name="channel_id" data-vv-as=""{{ __('admin::app.marketing.campaigns.channel') }}"">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ old('channel_id') == $channel->id ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@
|
|||
<select v-validate="'required'" class="control" id="channel_id" name="channel_id" data-vv-as=""{{ __('admin::app.marketing.campaigns.channel') }}"">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ $selectedOption == $channel->id ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ old('channels') && in_array($channel->id, old('channels')) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ old('channels') && in_array($channel->id, old('channels')) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $channel->name ?? $channel->translate(app()->getLocale())->name ?? $channel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
|
|||
|
|
@ -221,6 +221,24 @@ class Core
|
|||
return ($channel = $this->getDefaultChannel()) ? $channelCode = $channel->code : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the channel name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getChannelName($channel): string
|
||||
{
|
||||
static $channelName;
|
||||
|
||||
if ($channelName) {
|
||||
return $channelName;
|
||||
}
|
||||
|
||||
return $channelName = $channel->name
|
||||
?? $channel->translate(app()->getLocale())->name
|
||||
?? $channel->translate(config('app.fallback_locale'))->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all locales
|
||||
*
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<option
|
||||
value="{{ $channelModel->code }}"
|
||||
{{ (isset($channel) && ($channelModel->code) == $channel) ? 'selected' : '' }}>
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channelModel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
<option
|
||||
value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name ?? $channelModel->translate($locale)->name ?? $channelModel->translate(config('app.fallback_locale'))->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
|
|
|||
Loading…
Reference in New Issue