PluginProbe
Hello Plus / 1.2.0
Hello Plus v1.2.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / content / classes / choose-img-control.php

choose-img-control.php in Hello Plus 1.2.0, at modules/content/classes/choose-img-control.php

76 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace HelloPlus\Modules\Content\Classes;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 use Elementor\Control_Choose;
9
10 /**
11 * Elementor choose SVG or Image control.
12 *
13 * This control extends the base Choose control allowing the user to choose between options represented by SVG or Image.
14 *
15 * @since 1.0.0
16 */
17 class Choose_Img_Control extends Control_Choose {
18
19 const CONTROL_NAME = 'choose-img';
20
21 public function get_type() {
22 return self::CONTROL_NAME;
23 }
24
25 public function content_template() {
26 $control_uid_input_type = '{{value}}';
27 ?>
28 <div class="elementor-control-field">
29 <label class="elementor-control-title">{{{ data.label }}}</label>
30 <div class="elementor-control-input-wrapper">
31 <div
32 class="elementor-choices elementor-choices-img"
33 style="--elementor-choices-columns: {{ data.columns }};">
34
35 <# _.each( data.options, function( options, value ) { #>
36 <div class="elementor-choices-element">
37 <input id="<?php $this->print_control_uid( $control_uid_input_type ); ?>" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="{{ value }}">
38 <label class="elementor-choices-label elementor-control-unit-2 tooltip-target" for="<?php $this->print_control_uid( $control_uid_input_type ); ?>" data-tooltip="{{ options.title }}" title="{{ options.title }}">
39 <img class="elementor-choices-image" src="{{ options.image }}" aria-hidden="true" alt="{{ options.title }}" data-hover="{{ value }}" />
40 <span class="elementor-screen-only">{{{ options.title }}}</span>
41 </label>
42 </div>
43 <# } ); #>
44 </div>
45 </div>
46 </div>
47
48 <# if ( data.description ) { #>
49 <div class="elementor-control-field-description">{{{ data.description }}}</div>
50 <# } #>
51 <?php
52 }
53
54 /**
55 * Get default settings.
56 *
57 * Retrieve the default settings of the control. Used to return the default settings
58 * while initializing the control.
59 *
60 * @since 1.0.0
61 * @access protected
62 *
63 * @return array Control default settings.
64 * * - 'options' (array): An array of options for the control. Instead of 'icon', it uses the field 'image'.
65 * * - 'toggle' (bool): Whether the control should toggle between options.
66 * * - 'columns' (int): The number of columns to display the options in.
67 */
68 protected function get_default_settings() {
69 return [
70 'options' => [],
71 'toggle' => true,
72 'columns' => 1,
73 ];
74 }
75 }
76