popover-toggle.php (2601B)
1 <?php 2 namespace Elementor; 3 4 if ( ! defined( 'ABSPATH' ) ) { 5 exit; // Exit if accessed directly. 6 } 7 8 /** 9 * Elementor popover toggle control. 10 * 11 * A base control for creating a popover toggle control. By default displays a toggle 12 * button to open and close a popover. 13 * 14 * @since 1.9.0 15 */ 16 class Control_Popover_Toggle extends Base_Data_Control { 17 18 /** 19 * Get popover toggle control type. 20 * 21 * Retrieve the control type, in this case `popover_toggle`. 22 * 23 * @since 1.9.0 24 * @access public 25 * 26 * @return string Control type. 27 */ 28 public function get_type() { 29 return 'popover_toggle'; 30 } 31 32 /** 33 * Get popover toggle control default settings. 34 * 35 * Retrieve the default settings of the popover toggle control. Used to 36 * return the default settings while initializing the popover toggle 37 * control. 38 * 39 * @since 1.9.0 40 * @access protected 41 * 42 * @return array Control default settings. 43 */ 44 protected function get_default_settings() { 45 return [ 46 'return_value' => 'yes', 47 ]; 48 } 49 50 /** 51 * Render popover toggle 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.9.0 58 * @access public 59 */ 60 public function content_template() { 61 ?> 62 <div class="elementor-control-field"> 63 <label class="elementor-control-title">{{{ data.label }}}</label> 64 <div class="elementor-control-input-wrapper"> 65 <input id="<?php $this->print_control_uid(); ?>-custom" class="elementor-control-popover-toggle-toggle" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="{{ data.return_value }}"> 66 <label class="elementor-control-popover-toggle-toggle-label elementor-control-unit-1" for="<?php $this->print_control_uid(); ?>-custom"> 67 <i class="eicon-edit" aria-hidden="true"></i> 68 <span class="elementor-screen-only"><?php echo esc_html__( 'Edit', 'elementor' ); ?></span> 69 </label> 70 <input id="<?php $this->print_control_uid(); ?>-default" class="elementor-control-popover-toggle-reset" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value=""> 71 <label class="elementor-control-popover-toggle-reset-label tooltip-target" for="<?php $this->print_control_uid(); ?>-default" data-tooltip="<?php echo esc_html__( 'Back to default', 'elementor' ); ?>" data-tooltip-pos="s"> 72 <i class="eicon-undo" aria-hidden="true"></i> 73 <span class="elementor-screen-only"><?php echo esc_html__( 'Back to default', 'elementor' ); ?></span> 74 </label> 75 </div> 76 </div> 77 <?php 78 } 79 }