PluginProbe
Customify / 1.5.1
Customify v1.5.1
2.10.9 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.7.1 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.6.0 1.6.0.1 1.6.5 1.7.0 1.7.1 All 77 releases
customify / features / customizer / controls / class-Pix_Customize_Radio_Image_Control.php

class-Pix_Customize_Radio_Image_Control.php in Customify 1.5.1, at features/customizer/controls/class-Pix_Customize_Radio_Image_Control.php

90 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class Pix_Customize_Radio_Image_Control
5 * A simple Select2 Control
6 */
7 class Pix_Customize_Radio_Image_Control extends Pix_Customize_Control {
8 public $type = 'radio_image';
9 public $choices_type = 'radio';
10 public $description = null;
11
12 /**
13 * Render the control's content.
14 *
15 * @since 3.4.0
16 */
17 public function render_content() {
18
19 switch ( $this->choices_type ) {
20
21 case 'radio' : { ?>
22 <label>
23 <?php if ( ! empty( $this->label ) ) { ?>
24 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
25 <?php } ?>
26
27 <div class="customify_radio_image">
28 <?php
29 foreach ( $this->choices as $value => $image_url ){
30
31 if ( empty( $image_url ) ) {
32 $image_url = plugins_url() . '/customify/images/default_radio_image.png';
33 } ?>
34 <label>
35 <input <?php $this->link(); echo 'name="' . $this->setting->id . '" type="radio" value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) .' ></input>';?>
36 <img src="<?php echo $image_url; ?>" style="width: 50px; display: block; height: auto;"></span>
37 </label>
38 <?php } ?>
39 </div>
40
41 <?php if ( ! empty( $this->description ) ) { ?>
42 <span class="description customize-control-description"><?php echo $this->description; ?></span>
43 <?php } ?>
44 </label>
45 <?php break;
46 }
47
48 case 'buttons' : { ?>
49 <label>
50 <?php if ( ! empty( $this->label ) ) { ?>
51 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
52 <?php } ?>
53
54 <div class="customify_radio_image radio_buttons">
55 <?php
56 foreach ( $this->choices as $value => $setts ){
57 if ( ! isset( $setts['options']) || ! isset( $setts['label'] ) ) {
58 continue;
59 }
60 $color = '';
61 if ( isset( $setts['color'] ) ) {
62 $color .= ' style="border-left-color: ' . $setts['color'] . '; color: ' . $setts['color'] . ';"';
63 }
64
65 $label = $setts['label'];
66 $options = $setts['options'];
67 $data = ' data-options=\'' . json_encode($options) . '\'';?>
68
69 <fieldset class="customify_radio_button">
70 <input <?php $this->link(); echo 'name="' . $this->setting->id . '" type="radio" value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . $data .' />'; ?>
71 <label class="button" for="<?php echo $this->setting->id; ?>" <?php echo $color; ?>>
72 <?php echo $label; ?>
73 </label>
74 </fieldset>
75 <?php } ?>
76 </div>
77
78 <?php if ( ! empty( $this->description ) ) { ?>
79 <span class="description customize-control-description"><?php echo $this->description; ?></span>
80 <?php } ?>
81 </label>
82 <?php break;
83 }
84
85 default:
86 break;
87 }
88 }
89 }
90