'filter' => false, 'filter_type' => $this->_filterType, 'filter_label' => null, 'filter_values' => $this->_filterValues,
'translatable' => $this->_translatable, 'migrateTranslatable' => $this->_migrateTranslatable,
'preview' => $this->_preview,
- 'column_type' => $this->_columnType, 'column_move_after' => $this->_columnMoveAfter, 'column_format' => $this->_columnFormat, 'column_width' => 300, 'column_escape' => true,
+ 'column_type' => $this->_columnType, 'column_move_after' => $this->_columnMoveAfter, 'column_format' => $this->_columnFormat, 'column_width' => 300, 'column_escape' => true, 'column_limit' => 50,
'default' => $this->_default, 'non_default_tracking' => true,
'cast' => $this->_cast, 'column_view_namespace' => $this->_columnViewNamespace, 'searchLogic' => $this->_searchLogic,
'allow_null' => true,
'format' => $this->getAttribute('column_format', null),
'orderable' => true,
'escaped' => $this->getAttribute('column_escape', true),
+ 'limit' => $this->getAttribute('column_limit', 50),
];
if ($this->hasAttribute('column_function_name')) {
$res['limit'] = $this->getAttribute('column_limit');
}
-
return $res;
}
--- /dev/null
+{{-- regular object attribute --}}
+@php
+ $column['value'] = $column['value'] ?? data_get($entry, $column['name']);
+ $column['escaped'] = $column['escaped'] ?? true;
+ $column['limit'] = $column['limit'] ?? 32;
+ $column['prefix'] = $column['prefix'] ?? '';
+ $column['suffix'] = $column['suffix'] ?? '';
+ $column['text'] = $column['default'] ?? '-';
+
+ if($column['value'] instanceof \Closure) {
+ $column['value'] = $column['value']($entry);
+ }
+
+ if(is_array($column['value'])) {
+ $column['value'] = json_encode($column['value']);
+ }
+
+ if(!empty($column['value'])) {
+ $column['text'] = $column['prefix'].Str::limit($column['value'], $column['limit'], '…').$column['suffix'];
+ }
+@endphp
+
+<span style="white-space: normal">
+ @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_start')
+ @if($column['escaped'])
+ {{ $column['text'] }}
+ @else
+ {!! $column['text'] !!}
+ @endif
+ @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_end')
+</span>