| @@ -1,82 +1,82 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Main Elementor ImageSelectorControl Class | |
| 4 | - * | |
| 5 | - * The main class that initiates and runs the plugin. | |
| 6 | - * | |
| 7 | - * @package RadiusTheme\SB | |
| 8 | - * @since 1.0.0 | |
| 9 | - */ | |
| 10 | - | |
| 11 | -namespace RadiusTheme\SB\Elementor\Controls; | |
| 12 | - | |
| 13 | -use Elementor\Base_Data_Control; | |
| 14 | - | |
| 15 | -// Do not allow directly accessing this file. | |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 17 | - exit( 'This script cannot be accessed directly.' ); | |
| 18 | -} | |
| 19 | - | |
| 20 | -/** | |
| 21 | - * Main Elementor ImageSelectorControl Class | |
| 22 | - */ | |
| 23 | -class ImageSelectorControl extends Base_Data_Control { | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * Set control name. | |
| 27 | - * | |
| 28 | - * @var string | |
| 29 | - */ | |
| 30 | - public static $controlName = 'rtsb-image-selector'; | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * Set control type. | |
| 34 | - */ | |
| 35 | - public function get_type() { | |
| 36 | - return self::$controlName; | |
| 37 | - } | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * Enqueue control scripts and styles. | |
| 41 | - */ | |
| 42 | - public function enqueue() { | |
| 43 | - wp_enqueue_style( 'rtsb-image-selector', rtsb()->get_assets_uri( 'css/backend/elementor-image-selector.css' ), [], '1.0' ); | |
| 44 | - } | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * Set default settings | |
| 48 | - */ | |
| 49 | - protected function get_default_settings() { | |
| 50 | - return [ | |
| 51 | - 'label_block' => true, | |
| 52 | - 'toggle' => true, | |
| 53 | - 'options' => [], | |
| 54 | - ]; | |
| 55 | - } | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * Control field markup | |
| 59 | - */ | |
| 60 | - public function content_template() { | |
| 61 | - $control_uid = $this->get_control_uid( '{{ value }}' ); | |
| 62 | - ?> | |
| 63 | - <div class="elementor-control-field"> | |
| 64 | - <label class="elementor-control-title">{{{ data.label }}}</label> | |
| 65 | - <div class="elementor-control-image-selector-wrapper"> | |
| 66 | - <# _.each( data.options, function( options, value ) { #> | |
| 67 | - <div class="image-selector-inner{{ options.is_pro ? ' rtsb-pro' : '' }}" title="{{ ! options.is_pro ? '' : 'Upgrade to PRO!' }}" data-tooltip="{{ ! options.is_pro ? options.title : 'Upgrade to PRO!' }}"> | |
| 68 | - <input id="<?php echo esc_attr( $control_uid ); ?>" type="radio" name="elementor-image-selector-{{ data.name }}-{{ data._cid }}" value="{{ value }}" data-setting="{{ data.name }}"> | |
| 69 | - <label class="elementor-image-selector-label tooltip-target{{ options.is_pro ? ' is-pro' : '' }}" for="<?php echo esc_attr( $control_uid ); ?>" data-tooltip="{{ options.title }}" title="{{ options.title }}"> | |
| 70 | - <img src="{{ options.url }}" alt="{{ options.title }}"> | |
| 71 | - <span class="elementor-screen-only">{{{ options.title }}}</span> | |
| 72 | - </label> | |
| 73 | - </div> | |
| 74 | - <# } ); #> | |
| 75 | - </div> | |
| 76 | - <# if ( data.description ) { #> | |
| 77 | - <div class="elementor-control-field-description rtsb-description">{{{ data.description }}}</div> | |
| 78 | - <# } #> | |
| 79 | - </div> | |
| 80 | - <?php | |
| 81 | - } | |
| 82 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Main Elementor ImageSelectorControl Class | |
| 4 | + * | |
| 5 | + * The main class that initiates and runs the plugin. | |
| 6 | + * | |
| 7 | + * @package Classifid-listing | |
| 8 | + * @since 1.0.0 | |
| 9 | + */ | |
| 10 | + | |
| 11 | +namespace RadiusTheme\SB\Elementor\Controls; | |
| 12 | + | |
| 13 | +use Elementor\Base_Data_Control; | |
| 14 | + | |
| 15 | +// Do not allow directly accessing this file. | |
| 16 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 17 | + exit( 'This script cannot be accessed directly.' ); | |
| 18 | +} | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * Main Elementor ImageSelectorControl Class | |
| 22 | + */ | |
| 23 | +class ImageSelectorControl extends Base_Data_Control { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * Set control name. | |
| 27 | + * | |
| 28 | + * @var string | |
| 29 | + */ | |
| 30 | + public static $controlName = 'rtsb-image-selector'; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Set control type. | |
| 34 | + */ | |
| 35 | + public function get_type() { | |
| 36 | + return self::$controlName; | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * Enqueue control scripts and styles. | |
| 41 | + */ | |
| 42 | + public function enqueue() { | |
| 43 | + wp_enqueue_style( 'rtsb-image-selector', rtsb()->get_assets_uri( 'css/backend/elementor-image-selector.css' ), [], '1.0' ); | |
| 44 | + } | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * Set default settings | |
| 48 | + */ | |
| 49 | + protected function get_default_settings() { | |
| 50 | + return [ | |
| 51 | + 'label_block' => true, | |
| 52 | + 'toggle' => true, | |
| 53 | + 'options' => [], | |
| 54 | + ]; | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * Control field markup | |
| 59 | + */ | |
| 60 | + public function content_template() { | |
| 61 | + $control_uid = $this->get_control_uid( '{{ value }}' ); | |
| 62 | + ?> | |
| 63 | + <div class="elementor-control-field"> | |
| 64 | + <label class="elementor-control-title">{{{ data.label }}}</label> | |
| 65 | + <div class="elementor-control-image-selector-wrapper"> | |
| 66 | + <# _.each( data.options, function( options, value ) { #> | |
| 67 | + <div class="image-selector-inner{{ options.is_pro ? ' rtsb-pro' : '' }}" title="{{ ! options.is_pro ? '' : 'Upgrade to PRO!' }}" data-tooltip="{{ ! options.is_pro ? options.title : 'Upgrade to PRO!' }}"> | |
| 68 | + <input id="<?php echo esc_attr( $control_uid ); ?>" type="radio" name="elementor-image-selector-{{ data.name }}-{{ data._cid }}" value="{{ value }}" data-setting="{{ data.name }}"> | |
| 69 | + <label class="elementor-image-selector-label tooltip-target{{ options.is_pro ? ' is-pro' : '' }}" for="<?php echo esc_attr( $control_uid ); ?>" data-tooltip="{{ options.title }}" title="{{ options.title }}"> | |
| 70 | + <img src="{{ options.url }}" alt="{{ options.title }}"> | |
| 71 | + <span class="elementor-screen-only">{{{ options.title }}}</span> | |
| 72 | + </label> | |
| 73 | + </div> | |
| 74 | + <# } ); #> | |
| 75 | + </div> | |
| 76 | + <# if ( data.description ) { #> | |
| 77 | + <div class="elementor-control-field-description rtsb-description">{{{ data.description }}}</div> | |
| 78 | + <# } #> | |
| 79 | + </div> | |
| 80 | + <?php | |
| 81 | + } | |
| 82 | +} | |