PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / admin / views / sp-framework / functions / customize.php

customize.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.2.10, at admin/views/sp-framework/functions/customize.php

117 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) {
2 die;
3 } // Cannot access directly.
4 /**
5 *
6 * WP Customize custom panel
7 *
8 * @since 1.0.0
9 * @version 1.0.0
10 */
11 if ( ! class_exists( 'WP_Customize_Panel_SP_PC' ) && class_exists( 'WP_Customize_Panel' ) ) {
12 class WP_Customize_Panel_SP_PC extends WP_Customize_Panel {
13
14 public $type = 'spf';
15 }
16 }
17
18 /**
19 *
20 * WP Customize custom section
21 *
22 * @since 1.0.0
23 * @version 1.0.0
24 */
25 if ( ! class_exists( 'WP_Customize_Section_SP_PC' ) && class_exists( 'WP_Customize_Section' ) ) {
26 class WP_Customize_Section_SP_PC extends WP_Customize_Section {
27
28 public $type = 'spf';
29 }
30 }
31
32 /**
33 *
34 * WP Customize custom control
35 *
36 * @since 1.0.0
37 * @version 1.0.0
38 */
39 if ( ! class_exists( 'WP_Customize_Control_SP_PC' ) && class_exists( 'WP_Customize_Control' ) ) {
40 class WP_Customize_Control_SP_PC extends WP_Customize_Control {
41
42
43 public $type = 'spf';
44 public $field = '';
45 public $unique = '';
46
47 protected function render() {
48
49 $depend = '';
50 $hidden = '';
51
52 if ( ! empty( $this->field['dependency'] ) ) {
53 $hidden = ' spf-dependency-control hidden';
54 $depend .= ' data-controller="' . $this->field['dependency'][0] . '"';
55 $depend .= ' data-condition="' . $this->field['dependency'][1] . '"';
56 $depend .= ' data-value="' . $this->field['dependency'][2] . '"';
57 }
58
59 $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
60 $class = 'customize-control customize-control-' . $this->type . $hidden;
61
62 echo '<li id="' . $id . '" class="' . $class . '"' . $depend . '>';
63 $this->render_content();
64 echo '</li>';
65
66 }
67
68 public function render_content() {
69
70 $complex = array(
71 'accordion',
72 'background',
73 'backup',
74 'border',
75 'button_set',
76 'checkbox',
77 'color_group',
78 'date',
79 'dimensions',
80 'fieldset',
81 'group',
82 'image_select',
83 'link_color',
84 'media',
85 'palette',
86 'sortable',
87 'sorter',
88 'switcher',
89 'tabbed',
90 'typography',
91 );
92
93 $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
94 $custom = ( ! empty( $this->field['customizer'] ) ) ? true : false;
95 $is_complex = ( in_array( $this->field['type'], $complex ) ) ? true : false;
96 $class = ( $is_complex || $custom ) ? ' spf-customize-complex' : '';
97 $atts = ( $is_complex || $custom ) ? ' data-unique-id="' . $this->unique . '" data-option-id="' . $field_id . '"' : '';
98
99 if ( ! $is_complex && ! $custom ) {
100 $this->field['attributes']['data-customize-setting-link'] = $this->settings['default']->id;
101 }
102
103 $this->field['name'] = $this->settings['default']->id;
104
105 $this->field['dependency'] = array();
106
107 echo '<div class="spf-customize-field' . $class . '"' . $atts . '>';
108
109 SP_PC::field( $this->field, $this->value(), $this->unique, 'customize' );
110
111 echo '</div>';
112
113 }
114
115 }
116 }
117