I’m trying to get aviableColors but I’m getting an error:
The model class RainLab\Translate\Models\MLThemeData must define a method \My\Plugin\Models\Styles::myColorList() returning html color HEX codes for the 'bg' form field.
In themes/default/theme.yaml I added colorpicker field:
bg:
label: 'BG color'
type: colorpicker
availableColors: \My\Plugin\Models\Styles::myColorList
allowCustom: true
allowEmpty: true
showAlpha: true
span: auto
In styles model I added:
<?php namespace My\Plugin\Models;
use Event;
/**
* Model
*/
class Styles extends Model
{
public function myColorList($fieldName, $value, $formData)
{
return ['#000000', '#CCCCCC', '#FFFFFF'];
}
}
How to make it work?