.
*
* @package Hestia
* @since Hestia 1.0
*/
if ( ! class_exists( 'WP_Customize_Control' ) ) {
return null;
}
/**
* Class Hestia_Customize_Alpha_Color_Control
*/
class Hestia_Customize_Alpha_Color_Control extends WP_Customize_Control {
/**
* Official control name.
*
* @var string
*/
public $type = 'alpha-color';
/**
* Add support for palettes to be passed in.
*
* Supported palette values are true, false, or an array of RGBa and Hex colors.
*
* @var bool
*/
public $palette;
/**
* Add support for showing the opacity value on the slider handle.
*
* @var array
*/
public $show_opacity;
/**
* Render the control.
*/
public function render_content() {
// Process the palette
if ( is_array( $this->palette ) ) {
$palette = implode( '|', $this->palette );
} else {
// Default to true.
$palette = ( false === $this->palette || 'false' === $this->palette ) ? 'false' : 'true';
}
// Support passing show_opacity as string or boolean. Default to true.
$show_opacity = ( false === $this->show_opacity || 'false' === $this->show_opacity ) ? 'false' : 'true';
// Output the label and description if they were passed in.
if ( isset( $this->label ) && '' !== $this->label ) {
echo '' . sanitize_text_field( $this->label ) . '';
}
if ( isset( $this->description ) && '' !== $this->description ) {
echo '' . sanitize_text_field( $this->description ) . '';
}
?>