Is it possible to add type in laravel/OctoberCMS?
columns:
field:
value: field
type: specialdate
I’d like to have specialtype in backend (colors depends on value or some text instead of exact value (e.g. ZERO instead of 0 ;D
Is it possible to add type in laravel/OctoberCMS?
columns:
field:
value: field
type: specialdate
I’d like to have specialtype in backend (colors depends on value or some text instead of exact value (e.g. ZERO instead of 0 ;D
2
Answers
You can use a
partial
type of column to show what ever you want to show in columnsRef: https://docs.octobercms.com/1.x/backend/lists.html#partial
There are a few possibilities:
You can use the "Custom Value Selection" method described here: https://docs.octobercms.com/2.x/backend/lists.html#custom-value-selection.
You can simply add an accessor to your model and use that as the display value.
You could also use the partial field type to display whatever you want in the column:
https://docs.octobercms.com/2.x/backend/lists.html#partial
Those methods are best used for singular cases and custom implementation.
The best method for configurable columns would be creating a custom column type as described here: https://docs.octobercms.com/2.x/backend/lists.html#custom-column-types. Fairly straight-forward.
All the links are for OctoberCMS V2, but everything is also possible with V3. I am not sure about V1.