groups
1 year ago
alert.php
2 years ago
animation.php
3 years ago
base-data.php
3 years ago
base-icon-font.php
3 years ago
base-multiple.php
3 years ago
base-ui.php
3 years ago
base-units.php
2 years ago
base.php
3 years ago
box-shadow.php
3 years ago
button.php
3 years ago
choose.php
3 years ago
code.php
3 years ago
color.php
3 years ago
date-time.php
3 years ago
deprecated-notice.php
3 years ago
dimensions.php
3 years ago
divider.php
2 years ago
exit-animation.php
3 years ago
font.php
3 years ago
gallery.php
2 years ago
gaps.php
2 years ago
heading.php
3 years ago
hidden.php
3 years ago
hover-animation.php
1 year ago
icon.php
2 years ago
icons.php
2 years ago
image-dimensions.php
3 years ago
media.php
2 years ago
notice.php
2 years ago
number.php
3 years ago
popover-toggle.php
3 years ago
raw-html.php
3 years ago
repeater.php
1 year ago
section.php
2 years ago
select.php
3 years ago
select2.php
2 years ago
slider.php
3 years ago
structure.php
2 years ago
switcher.php
3 years ago
tab.php
2 years ago
tabs.php
2 years ago
text-shadow.php
3 years ago
text.php
3 years ago
textarea.php
3 years ago
url.php
2 years ago
wp-widget.php
3 years ago
wysiwyg.php
3 years ago
choose.php
84 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | exit; // Exit if accessed directly. |
| 6 | } |
| 7 | |
| 8 | /** |
| 9 | * Elementor choose control. |
| 10 | * |
| 11 | * A base control for creating choose control. Displays radio buttons styled as |
| 12 | * groups of buttons with icons for each option. |
| 13 | * |
| 14 | * @since 1.0.0 |
| 15 | */ |
| 16 | class Control_Choose extends Base_Data_Control { |
| 17 | |
| 18 | /** |
| 19 | * Get choose control type. |
| 20 | * |
| 21 | * Retrieve the control type, in this case `choose`. |
| 22 | * |
| 23 | * @since 1.0.0 |
| 24 | * @access public |
| 25 | * |
| 26 | * @return string Control type. |
| 27 | */ |
| 28 | public function get_type() { |
| 29 | return 'choose'; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Render choose control output in the editor. |
| 34 | * |
| 35 | * Used to generate the control HTML in the editor using Underscore JS |
| 36 | * template. The variables for the class are available using `data` JS |
| 37 | * object. |
| 38 | * |
| 39 | * @since 1.0.0 |
| 40 | * @access public |
| 41 | */ |
| 42 | public function content_template() { |
| 43 | $control_uid_input_type = '{{value}}'; |
| 44 | ?> |
| 45 | <div class="elementor-control-field"> |
| 46 | <label class="elementor-control-title">{{{ data.label }}}</label> |
| 47 | <div class="elementor-control-input-wrapper"> |
| 48 | <div class="elementor-choices"> |
| 49 | <# _.each( data.options, function( options, value ) { #> |
| 50 | <input id="<?php $this->print_control_uid( $control_uid_input_type ); ?>" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="{{ value }}"> |
| 51 | <label class="elementor-choices-label elementor-control-unit-1 tooltip-target" for="<?php $this->print_control_uid( $control_uid_input_type ); ?>" data-tooltip="{{ options.title }}" title="{{ options.title }}"> |
| 52 | <i class="{{ options.icon }}" aria-hidden="true"></i> |
| 53 | <span class="elementor-screen-only">{{{ options.title }}}</span> |
| 54 | </label> |
| 55 | <# } ); #> |
| 56 | </div> |
| 57 | </div> |
| 58 | </div> |
| 59 | |
| 60 | <# if ( data.description ) { #> |
| 61 | <div class="elementor-control-field-description">{{{ data.description }}}</div> |
| 62 | <# } #> |
| 63 | <?php |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Get choose control default settings. |
| 68 | * |
| 69 | * Retrieve the default settings of the choose control. Used to return the |
| 70 | * default settings while initializing the choose control. |
| 71 | * |
| 72 | * @since 1.0.0 |
| 73 | * @access protected |
| 74 | * |
| 75 | * @return array Control default settings. |
| 76 | */ |
| 77 | protected function get_default_settings() { |
| 78 | return [ |
| 79 | 'options' => [], |
| 80 | 'toggle' => true, |
| 81 | ]; |
| 82 | } |
| 83 | } |
| 84 |