PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.2
Elementor Website Builder – more than just a page builder v4.2.2
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / includes / controls / visual-choice.php

visual-choice.php in Elementor Website Builder – more than just a page builder 4.2.2, at includes/controls/visual-choice.php

71 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 /**
9 * Elementor Visual Choice control.
10 *
11 * This control extends the base Choose control allowing the user to choose between options represented by SVG or Image.
12 *
13 * @since 3.28.0
14 */
15 class Control_Visual_Choice extends Base_Data_Control {
16
17 public function get_type() {
18 return 'visual_choice';
19 }
20
21 public function content_template() {
22 $control_uid_input_type = '{{value}}';
23 ?>
24 <div class="elementor-control-field">
25 <label class="elementor-control-title">{{{ data.label }}}</label>
26 <div class="elementor-control-input-wrapper">
27 <div class="elementor-visual-choice-choices" style="--elementor-visual-choice-columns: {{ data.columns }};">
28 <#
29 _.each( data.options, function( options, value ) {
30 choiceType = options.type || 'image';
31 #>
32 <div class="elementor-visual-choice-element elementor-visual-choice-element-{{ choiceType }}" style="--elementor-visual-choice-span: {{ data.toggle ? '1' : '0' }};">
33 <input id="<?php $this->print_control_uid( $control_uid_input_type ); ?>" type="radio" name="elementor-visual-choice-{{ data.name }}-{{ data._cid }}" value="{{ value }}" class="elementor-screen-only">
34 <label class="elementor-visual-choice-label tooltip-target" for="<?php $this->print_control_uid( $control_uid_input_type ); ?>" data-tooltip="{{ options.title }}">
35 <#
36 switch ( choiceType ) {
37 case 'button':
38 #>
39 <div class="elementor-button">{{{ options.title }}}</div>
40 <#
41 break;
42 case 'image':
43 default:
44 #>
45 <img src="{{ options.image }}" aria-hidden="true" alt="{{ options.title }}" data-hover="{{ value }}" />
46 <span class="elementor-screen-only">{{{ options.title }}}</span>
47 <#
48 };
49 #>
50 </label>
51 </div>
52 <# } ); #>
53 </div>
54 </div>
55 </div>
56
57 <# if ( data.description ) { #>
58 <div class="elementor-control-field-description">{{{ data.description }}}</div>
59 <# } #>
60 <?php
61 }
62
63 protected function get_default_settings() {
64 return [
65 'options' => [],
66 'toggle' => true,
67 'columns' => 1,
68 ];
69 }
70 }
71