Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.
You might want to read an updated version of this page for the current version, PrestaShop 8. Read the updated version of this page
It is used to display a color field data as a background-colored badge in Grid.
Properties | Type | Expected value |
---|---|---|
field | string | required The record field name that the column displays. |
color_field | string | required The field name of the color to display. |
<?php
use PrestaShop\PrestaShop\Core\Grid\Column\Type\ColorColumn;
use PrestaShop\PrestaShop\Core\Grid\Column\ColumnCollection;
$colorColumn = new ColorColumn('color');
$colorColumn->setName('color');
$colorColumn->setOptions([
'field' => 'color',
'color_field' => 'color'
]);
$columns = new ColumnCollection();
$columns->add($colorColumn);