Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/elementor/includes/controls/select.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
namespace Elementor;
3
+
4
+
if ( ! defined( 'ABSPATH' ) ) {
5
+
exit; // Exit if accessed directly.
6
+
}
7
+
8
+
/**
9
+
* Elementor select control.
10
+
*
11
+
* A base control for creating select control. Displays a simple select box.
12
+
* It accepts an array in which the `key` is the option value and the `value` is
13
+
* the option name.
14
+
*
15
+
* @since 1.0.0
16
+
*/
17
+
class Control_Select extends Base_Data_Control {
18
+
19
+
/**
20
+
* Get select control type.
21
+
*
22
+
* Retrieve the control type, in this case `select`.
23
+
*
24
+
* @since 1.0.0
25
+
* @access public
26
+
*
27
+
* @return string Control type.
28
+
*/
29
+
public function get_type() {
30
+
return 'select';
31
+
}
32
+
33
+
/**
34
+
* Get select control default settings.
35
+
*
36
+
* Retrieve the default settings of the select control. Used to return the
37
+
* default settings while initializing the select control.
38
+
*
39
+
* @since 2.0.0
40
+
* @access protected
41
+
*
42
+
* @return array Control default settings.
43
+
*/
44
+
protected function get_default_settings() {
45
+
return [
46
+
'options' => [],
47
+
];
48
+
}
49
+
50
+
/**
51
+
* Render select control output in the editor.
52
+
*
53
+
* Used to generate the control HTML in the editor using Underscore JS
54
+
* template. The variables for the class are available using `data` JS
55
+
* object.
56
+
*
57
+
* @since 1.0.0
58
+
* @access public
59
+
*/
60
+
public function content_template() {
61
+
?>
62
+
<div class="elementor-control-field {{ data.content_classes }}">
63
+
<# if ( data.label ) {#>
64
+
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
65
+
<# } #>
66
+
<div class="elementor-control-input-wrapper elementor-control-unit-5">
67
+
<select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
68
+
<#
69
+
var printOptions = function( options ) {
70
+
_.each( options, function( option_title, option_value ) { #>
71
+
<?php // If the option title is array of title & icon. ?>
72
+
<option value="{{ option_value }}">{{{ option_title?.title || option_title }}}</option>
73
+
<# } );
74
+
};
75
+
76
+
if ( data.groups ) {
77
+
for ( var groupIndex in data.groups ) {
78
+
var groupArgs = data.groups[ groupIndex ];
79
+
if ( groupArgs.options ) { #>
80
+
<optgroup label="{{ groupArgs.label }}">
81
+
<# printOptions( groupArgs.options ) #>
82
+
</optgroup>
83
+
<# } else if ( _.isString( groupArgs ) ) { #>
84
+
<option value="{{ groupIndex }}">{{{ groupArgs }}}</option>
85
+
<# }
86
+
}
87
+
} else {
88
+
printOptions( data.options );
89
+
}
90
+
#>
91
+
</select>
92
+
</div>
93
+
</div>
94
+
<# if ( data.description ) { #>
95
+
<div class="elementor-control-field-description">{{{ data.description }}}</div>
96
+
<# } #>
97
+
<?php
98
+
}
99
+
}
100
+