PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / customizer / packages / controls / image / src / Control / Image.php
kirki / customizer / packages / controls / image / src / Control Last commit date
Image.php 3 months ago
Image.php
89 lines
1 <?php
2 /**
3 * Customizer Control: image.
4 *
5 * @package kirki-framework/control-image
6 * @copyright Copyright (c) 2023, Themeum
7 * @license https://opensource.org/licenses/MIT
8 * @since 1.0
9 */
10
11 namespace Kirki\Control;
12
13 use Kirki\Control\Base;
14 use Kirki\URL;
15
16 /**
17 * Adds the image control.
18 *
19 * @since 1.0
20 */
21 class Image extends Base {
22
23 /**
24 * The control type.
25 *
26 * @access public
27 * @since 1.0
28 * @var string
29 */
30 public $type = 'kirki-image';
31
32 /**
33 * The version. Used in scripts & styles for cache-busting.
34 *
35 * @static
36 * @access public
37 * @since 1.0
38 * @var string
39 */
40 public static $control_ver = '1.0.2';
41
42 /**
43 * Enqueue control related scripts/styles.
44 *
45 * @access public
46 */
47
48
49 /**
50 * An Underscore (JS) template for this control's content (but not its container).
51 *
52 * Class variables for this control class are available in the `data` JS object;
53 * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
54 *
55 * @see WP_Customize_Control::print_template()
56 *
57 * @access protected
58 * @since 1.1
59 * @return void
60 */
61 protected function content_template() {
62 ?>
63 <label>
64 <span class="customize-control-title">{{{ data.label }}}</span>
65 <# if ( data.description ) { #>
66 <span class="description customize-control-description">{{{ data.description }}}</span>
67 <# } #>
68 </label>
69 <div class="image-wrapper attachment-media-view image-upload">
70 <# url = ( _.isObject( data.value ) && ! _.isUndefined( data.value.url ) ) ? data.value.url : data.value; #>
71 <# if ( data.value.url || '' !== url ) { #>
72 <div class="thumbnail thumbnail-image">
73 <img src="{{ url }}"/>
74 </div>
75 <# } else { #>
76 <div class="placeholder"><?php esc_html_e( 'No image selected', 'kirki' ); ?></div>
77 <# } #>
78 <div class="actions">
79 <button class="button image-upload-remove-button<# if ( '' === url ) { #> hidden <# } #>"><?php esc_html_e( 'Remove', 'kirki' ); ?></button>
80 <# if ( data.default && '' !== data.default ) { #>
81 <button type="button" class="button image-default-button"<# if ( data.default === data.value || ( ! _.isUndefined( data.value.url ) && data.default === data.value.url ) ) { #> style="display:none;"<# } #>><?php esc_html_e( 'Default', 'kirki' ); ?></button>
82 <# } #>
83 <button type="button" class="button image-upload-button"><?php esc_html_e( 'Select image', 'kirki' ); ?></button>
84 </div>
85 </div>
86 <?php
87 }
88 }
89