|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* LSX functions and definitions - Customizer - Mobile Header Layout. |
|
4
|
|
|
* |
|
5
|
|
|
* @package lsx |
|
6
|
|
|
* @subpackage customizer |
|
7
|
|
|
* @category mobile-header-layout |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
|
11
|
|
|
exit; |
|
12
|
|
|
} |
|
13
|
|
|
|
|
14
|
|
|
if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
15
|
|
|
return; |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
if ( ! class_exists( 'LSX_Customize_Mobile_Header_Layout_Control' ) ) : |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* LSX_Customize_Mobile_Header_Layout_Control Class |
|
22
|
|
|
* |
|
23
|
|
|
* @package lsx |
|
24
|
|
|
* @subpackage customizer |
|
25
|
|
|
* @category mobile-header-layout |
|
26
|
|
|
*/ |
|
27
|
|
|
class LSX_Customize_Mobile_Header_Layout_Control extends WP_Customize_Control { |
|
28
|
|
|
|
|
29
|
|
|
public $type = 'layout'; |
|
30
|
|
|
public $statuses; |
|
31
|
|
|
public $layouts = array(); |
|
32
|
|
|
|
|
33
|
|
|
public function __construct( $manager, $id, $args = array() ) { |
|
34
|
|
|
parent::__construct( $manager, $id, $args ); |
|
35
|
|
|
|
|
36
|
|
|
if ( ! empty( $args['choices'] ) ) { |
|
37
|
|
|
$this->layouts = $args['choices']; |
|
38
|
|
|
} |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Enqueue scripts/styles for the color picker. |
|
43
|
|
|
*/ |
|
44
|
|
|
public function enqueue() { |
|
45
|
|
|
wp_enqueue_script( 'lsx-mobile-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-mobile-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Render output. |
|
50
|
|
|
*/ |
|
51
|
|
|
public function render_content() { |
|
52
|
|
|
$post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
53
|
|
|
$class = 'customize-control customize-control-' . $this->type; |
|
54
|
|
|
$value = $this->value(); |
|
55
|
|
|
?> |
|
56
|
|
|
<label> |
|
57
|
|
|
<?php |
|
58
|
|
|
if ( ! empty( $this->label ) ) { |
|
59
|
|
|
?> |
|
60
|
|
|
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
61
|
|
|
<?php |
|
62
|
|
|
} |
|
63
|
|
|
if ( ! empty( $this->description ) ) { |
|
64
|
|
|
?> |
|
65
|
|
|
<span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
66
|
|
|
<?php } ?> |
|
67
|
|
|
<div class="mobile-header-layouts-selector"> |
|
68
|
|
|
<?php |
|
69
|
|
|
foreach ( $this->layouts as $layout ) { |
|
70
|
|
|
$sel = 'border: 1px solid transparent;'; |
|
71
|
|
|
if ( $value === $layout ) { |
|
72
|
|
|
$sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
73
|
|
|
} |
|
74
|
|
|
echo '<img class="mobile-header-layout-button" style="max-width:180px;padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
75
|
|
|
} |
|
76
|
|
|
?> |
|
77
|
|
|
<input <?php $this->link(); ?> class="selected-mobile-header-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
|
78
|
|
|
</div> |
|
79
|
|
|
</label> |
|
80
|
|
|
<?php |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
endif; |
|
86
|
|
|
|