/** @var $field Field */
if ($field->isDisplayColumn()) {
$this->crud->addColumn($field->getColumnData());
+ $moveAfter = $field->getAttribute('column_move_after', false);
+ if ($moveAfter !== false) {
+ $this->crud->afterColumn($moveAfter);
+ }
}
$this->crud->addField($field->getDefinition(), $field->getCRUDForm());
+ $this->crud->orderFields(['id','variant']);
+
$this->_fields[$field->getAttribute('name')] = $field;
}
protected $_rules = [];
protected $_columnType = 'text';
+ protected $_columnMoveAfter = false;
+
protected $_adminType = 'text';
protected $_viewNamespace = 'crud::fields';
protected $_columnViewNamespace = 'crud::columns';
return ['type' => $this->_adminType, 'view_namespace' => $this->_viewNamespace, 'column' => false, 'form' => 'both', 'rules' => '',
'fillable' => true, 'guarded' => false, 'hidden' => false,
'translatable' => $this->_translatable, 'migrateTranslatable' => $this->_migrateTranslatable,
- 'column_type' => $this->_columnType, 'default' => '', 'cast' => $this->_cast, 'column_view_namespace' => $this->_columnViewNamespace, 'searchLogic' => $this->_searchLogic,
+ 'column_type' => $this->_columnType, 'column_move_after' => $this->_columnMoveAfter,
+ 'default' => '', 'cast' => $this->_cast, 'column_view_namespace' => $this->_columnViewNamespace, 'searchLogic' => $this->_searchLogic,
'allow_null' => true,
'fake' => false, 'store_in' => 'extras', 'attributes' => []];
}
{
return $value;
}
+
+ public function filterColumn($value)
+ {
+ return $value;
+ }
}
$attributes['options'] = ['default' => 'default'];
$attributes['default'] = 'default';
} else {
+ $attributes['column'] = true;
+ $attributes['column_move_after'] = 'id';
$attributes['options'] = array_combine($variants, $variants);
$attributes['default'] = array_values($attributes['options']);
}
'label' => trans('Page name'),
'type' => 'Text',
'column' => true,
- 'column_move_after'=>'id',
+ 'column_move_after' => 'id',
'translatable' => false,
'hint' => trans('for admin use'),
'tab' => 'Informations principales',
$array_of_values[] = $column['options'][$value];
}
- if (count($array_of_values) > 1) {
- echo implode(', ', $array_of_values);
- } else {
- echo $array_of_values;
- }
+ echo implode(', ', $array_of_values);
} else {
if (isset($column['options'][$values])) {
echo $column['options'][$values];
- }else{
+ } else {
echo '-';
}
}