Skip to content

Instantly share code, notes, and snippets.

@spencerfinnell
Last active July 2, 2018 11:56
Show Gist options
  • Save spencerfinnell/2f0608fd6ffecc1e37517586e9341838 to your computer and use it in GitHub Desktop.
Save spencerfinnell/2f0608fd6ffecc1e37517586e9341838 to your computer and use it in GitHub Desktop.
<?php
/**
* Extend color picker control.
*
* @since 1.8.0
*
* @package BigBox
* @category Theme
* @author Spencer Finnell
*/
namespace BigBox\Customize;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Add a color picker control with a defined palette.
*
* @since 1.0.0
*/
class WP_Customize_Color_Control extends \WP_Customize_Color_Control {
/**
* Control type.
*
* @since 1.8.0
* @var string
*/
public $type = 'color-better-palettes';
/**
* Color palettes.
*
* @since 1.8.0
* @var array
*/
public $palettes = [];
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @since 1.8.0
*/
public function to_json() {
parent::to_json();
$this->json['palettes'] = $this->palettes;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment