Notice: You are browsing the documentation for PrestaShop 9, which is currently in development.

You might want to read the documentation for the current version, PrestaShop 8. Read the current version of this page

ColorColumn Type

It is used to display a color field data as a background-colored badge in Grid.

Available options

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.

Example usage

<?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);