class Locale extends SelectFromArray
{
+ protected $_limitToLocales = null;
+
public function __construct($attributes)
{
$this->_options = $this->_getLocales();
protected function _getLocales()
{
$list = \Cubist\Locale\Locale::getList(App::getLocale());
+ if ($this->_limitToLocales !== null) {
+ $limitedList = [];
+ foreach ($list as $code => $name) {
+ if (!in_array($code, $this->_limitToLocales)) {
+ continue;
+ }
+ $limitedList[$code] = $name;
+ }
+ $list = $limitedList;
+ }
$res = [];
foreach ($list as $code => $name) {
<?php
-
namespace Cubist\Backpack\Magic\Fields;
-use Illuminate\Support\Facades\App;
-
class LocaleEnabled extends Locale
{
- /**
- * @return array
- */
- protected function _getLocales()
- {
- $list = \Cubist\Locale\Locale::getList(App::getLocale());
-
- $res = [];
- foreach ($list as $code => $name) {
- $res[$code] = $code . ' | ' . $name;
- }
- return $res;
- }
}
--- /dev/null
+{{-- regular object attribute --}}
+@php
+ $value = data_get($entry, $column['name']);
+ $value = is_array($value) ? json_encode($value) : $value;
+ try{
+ $v=$entry->getField($column['name'])->filterColumn($value);
+ }catch (Exception $e){
+ $v=$value;
+ }
+
+@endphp
+
+<span>
+ @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_start')
+ {!!$v !!}
+ @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_end')
+</span>