|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
if ( ! class_exists( 'LSX_Customizer_Colour_Control' ) ) { |
|
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* LSX Customizer Colour Control Class |
|
6
|
|
|
* |
|
7
|
|
|
* @package LSX Customizer |
|
8
|
|
|
* @author LightSpeed |
|
9
|
|
|
* @license GPL3 |
|
10
|
|
|
* @link |
|
11
|
|
|
* @copyright 2016 LightSpeed |
|
12
|
|
|
*/ |
|
13
|
|
|
class LSX_Customizer_Colour_Control extends WP_Customize_Control { |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Enqueue control related scripts/styles. |
|
17
|
|
|
* |
|
18
|
|
|
* @since 1.0.0 |
|
19
|
|
|
*/ |
|
20
|
|
|
public function enqueue() { |
|
|
|
|
|
|
21
|
|
|
wp_enqueue_script( 'lsx_customizer_colour_admin', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-colour-admin.min.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), LSX_CUSTOMIZER_VER, true ); |
|
22
|
|
|
//wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme', $this->choices ); |
|
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
global $customizer_colour_names; |
|
25
|
|
|
$colors = array(); |
|
26
|
|
|
foreach ( $customizer_colour_names as $key => $value ) { |
|
|
|
|
|
|
27
|
|
|
$colors[] = $key; |
|
28
|
|
|
} |
|
|
|
|
|
|
29
|
|
|
wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme_keys', $colors ); |
|
30
|
|
|
} |
|
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Render the control's content. |
|
34
|
|
|
* |
|
35
|
|
|
* @since 1.0.0 |
|
36
|
|
|
*/ |
|
37
|
|
|
public function render_content() { |
|
38
|
|
|
if ( empty( $this->choices ) ) { |
|
|
|
|
|
|
39
|
|
|
return; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
?> |
|
43
|
|
|
<label> |
|
44
|
|
|
<?php if ( ! empty( $this->label ) ) { ?> |
|
|
|
|
|
|
45
|
|
|
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
46
|
|
|
<?php |
|
47
|
|
|
} |
|
|
|
|
|
|
48
|
|
|
if ( ! empty( $this->description ) ) { |
|
|
|
|
|
|
49
|
|
|
?> |
|
50
|
|
|
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
51
|
|
|
<?php } ?> |
|
|
|
|
|
|
52
|
|
|
<select <?php $this->link(); ?>> |
|
53
|
|
|
<?php |
|
54
|
|
|
foreach ( $this->choices as $value => $label ) { |
|
|
|
|
|
|
55
|
|
|
echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . esc_html( $label['label'] ) . '</option>'; |
|
56
|
|
|
} |
|
57
|
|
|
?> |
|
58
|
|
|
</select> |
|
59
|
|
|
</label> |
|
60
|
|
|
<?php |
|
61
|
|
|
} |
|
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
|