[Feature Request] Color palette support for external plugins
-
Hi, I am the author of Central Color Palette and I was asked to make my plugin compatible with Mega Max Menu. My plugin manages a color palette that can be used across WordPress and usually shows up in various color pickers. I had a look at the code of the free version of you plugin to find out if it does already offer a way to do so. Unfortunately it does not but as it uses spectrum which comes with palette support so making my plugin compatible with yours would be easy.
A possible solution would look like this:
js/settings.js:54 [...] showPalette: true, palette: $.isArray(window.megamax_spectrum_palette) ? window.megamax_spectrum_palette : [], localStorageKey: "maxmegamenu.themeeditor", [...]
megamax_spectrum_palette
is a global JavaScript variable that could be printed via theadmin_print_scrips
action hook on all those pages that uses spectrum:function megamenu_print_spectrum_palette () { $palette = apply_filters('megamax_color_palette', false); if (is_array($palette)) { print ' <script type="text/javascript" id="megamax_spectrum_palette_js"> var megamax_spectrum_palette = [' . json_encode($palette) . ']; </script>'; } } [...] add_action('admin_print_scripts', 'megamenu_print_spectrum_palette');
- The topic ‘[Feature Request] Color palette support for external plugins’ is closed to new replies.