public function Field($properties = array()) { $this->addExtraClass('ColorpaletteInput'); ColorpaletteHelper::requirements(); Requirements::javascript("calendar/javascript/admin/ColorpaletteField.js"); $source = $this->getSource(); //adding the current value to the mix if isn't in the array $val = $this->getColorWithHash(); $this->value = $val; $source[$val] = $val; $this->setSource($source); return parent::Field(); }
public function updateCMSFields(FieldList $fields) { $colors = ColorpaletteHelper::get_palette(); $fields->removeByName('Color'); $fields->addFieldToTab('Root.Main', new ColorpaletteField('Color', 'Colour', $colors)); }