EAEL_Background.php
1 year ago
EAEL_Choose.php
8 months ago
EAEL_Gradient_Text.php
6 days ago
Select2.php
4 months ago
index.php
3 years ago
EAEL_Choose.php
86 lines
| 1 | <?php |
| 2 | namespace Essential_Addons_Elementor\Controls; |
| 3 | use Elementor\Control_Choose; |
| 4 | |
| 5 | if ( ! defined( 'ABSPATH' ) ) { |
| 6 | exit; // Exit if accessed directly. |
| 7 | } |
| 8 | |
| 9 | /** |
| 10 | * Elementor choose control. |
| 11 | * |
| 12 | * A base control for creating choose control. Displays radio buttons styled as |
| 13 | * groups of buttons with icons for each option. |
| 14 | * |
| 15 | * @since 5.6.0 |
| 16 | */ |
| 17 | class EAEL_Choose extends Control_Choose { |
| 18 | |
| 19 | /** |
| 20 | * Render choose control output in the editor. |
| 21 | * |
| 22 | * Used to generate the control HTML in the editor using Underscore JS |
| 23 | * template. The variables for the class are available using `data` JS |
| 24 | * object. |
| 25 | * |
| 26 | * @since 5.6.0 |
| 27 | * @access public |
| 28 | */ |
| 29 | public function content_template() { |
| 30 | $control_uid_input_type = '{{value}}'; |
| 31 | ?> |
| 32 | <div class="elementor-control-field"> |
| 33 | <label class="elementor-control-title">{{{ data.label }}}</label> |
| 34 | <div class="elementor-control-input-wrapper"> |
| 35 | <div class="elementor-choices {{ data.image_choose ? ' eael-image-choices ' : ' eael-choices ' }}{{ data.multiline ? ' eael-multiline ' : '' }} {{ data.css_class ? data.css_class : '' }}"> |
| 36 | <# _.each( data.options, function( options, value ) { #> |
| 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-1 {{ !options.text ? ' tooltip-target' : '' }} {{ options.fullwidth ? ' fullwidth' : '' }}" |
| 39 | for="<?php $this->print_control_uid( $control_uid_input_type ); ?>" |
| 40 | data-tooltip="{{ options.title }}" |
| 41 | title="{{ options.title }}" |
| 42 | style="{{ options.height ? 'height: ' + options.height + ';' : '' }}"> |
| 43 | <# if( options.image ){ #> |
| 44 | <img class="eael-image-option" src="{{ options.image }}" alt="{{ options.title }}" /> |
| 45 | <# if( options.title && options?.fullwidth ){ #> |
| 46 | <span class="eael-text-option">{{{ options.title }}}</span> |
| 47 | <# } #> |
| 48 | <# } else if( options.text ){ #> |
| 49 | <span class="eael-text-option">{{{ options.text }}}</span> |
| 50 | <# } else{ #> |
| 51 | <i class="{{ options.icon }}" aria-hidden="true"></i> |
| 52 | <# if( options.title && options?.fullwidth ){ #> |
| 53 | <span class="eael-text-option">{{{ options.title }}}</span> |
| 54 | <# } #> |
| 55 | <# } #> |
| 56 | <span class="elementor-screen-only">{{{ options.title }}}</span> |
| 57 | </label> |
| 58 | <# } ); #> |
| 59 | </div> |
| 60 | </div> |
| 61 | </div> |
| 62 | |
| 63 | <# if ( data.description ) { #> |
| 64 | <div class="elementor-control-field-description">{{{ data.description }}}</div> |
| 65 | <# } #> |
| 66 | <?php |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Get choose control default settings. |
| 71 | * |
| 72 | * Retrieve the default settings of the choose control. Used to return the |
| 73 | * default settings while initializing the choose control. |
| 74 | * |
| 75 | * @since 5.6.0 |
| 76 | * @access protected |
| 77 | * |
| 78 | * @return array Control default settings. |
| 79 | */ |
| 80 | protected function get_default_settings() { |
| 81 | return [ |
| 82 | 'options' => [], |
| 83 | 'toggle' => true, |
| 84 | ]; |
| 85 | } |
| 86 | } |