public function __construct($name, $title = null, $source = null, $value = "", $form = null) { if (!is_array($source)) { $source = ColorpaletteHelper::get_palette(); } parent::__construct($name, $title === null ? $name : $title, $source, $value, $form); }
public function updateCMSFields(FieldList $fields) { $colors = ColorpaletteHelper::get_palette(); $fields->removeByName('Color'); $fields->addFieldToTab('Root.Main', new ColorpaletteField('Color', 'Colour', $colors)); }