Commit 15ba8fc5 authored by targoo's avatar targoo

fix palette

parent 6494c858
......@@ -592,9 +592,14 @@ function color_field_field_widget_form(&$form, &$form_state, $field, $instance,
$settings['show_input'] = (isset($field['settings']['show_input']) && $field['settings']['show_input'] == 1) ? TRUE: FALSE;
$settings['show_palette'] = (isset($field['settings']['show_palette']) && $field['settings']['show_palette'] == 1) ? TRUE: FALSE;
$settings['show_palette_only'] = (isset($field['settings']['show_palette_only']) && $field['settings']['show_palette_only'] == 1) ? TRUE: FALSE;
$settings['palette'] = (isset($field['settings']['palette']) && $field['settings']['palette'] != '') ? $field['settings']['palette'] : '';
$settings['show_buttons'] = (isset($field['settings']['show_buttons']) && $field['settings']['show_buttons'] == 1) ? TRUE: FALSE;
$default_colors = (isset($field['settings']['palette']) && $field['settings']['palette'] != '') ? $field['settings']['palette'] : '';
preg_match_all("/#[0-9a-fA-F]{6}/", $default_colors, $default_colors, PREG_SET_ORDER);
foreach ($default_colors as $color) {
$settings['palette'][] = $color[0];
}
$widget += array(
'#type' => 'textfield',
'#description' => t('Format #FFFFFF'),
......
......@@ -6,7 +6,6 @@
Drupal.behaviors.color_field_spectrum = {
attach: function (context) {
$.each(Drupal.settings.color_field_spectrum, function (selector) {
console.log(this);
$('#' + this.id).spectrum({
preferredFormat: "hex",
showInput: this.show_input,
......@@ -14,7 +13,7 @@
showInitial: true,
showPalette: this.show_palette,
showPaletteOnly: this.show_palette_only,
palette: [this.show_palette],
palette:[this.palette],
showButtons: this.show_buttons,
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment