structure.php (2547B)
1 <?php 2 namespace Elementor; 3 4 if ( ! defined( 'ABSPATH' ) ) { 5 exit; // Exit if accessed directly. 6 } 7 8 /** 9 * Elementor structure control. 10 * 11 * A base control for creating structure control. A private control for section 12 * columns structure. 13 * 14 * @since 1.0.0 15 */ 16 class Control_Structure extends Base_Data_Control { 17 18 /** 19 * Get structure control type. 20 * 21 * Retrieve the control type, in this case `structure`. 22 * 23 * @since 1.0.0 24 * @access public 25 * 26 * @return string Control type. 27 */ 28 public function get_type() { 29 return 'structure'; 30 } 31 32 /** 33 * Render structure 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 ?> 44 <div class="elementor-control-field"> 45 <div class="elementor-control-input-wrapper"> 46 <# 47 var morePresets = getMorePresets(); 48 49 if ( morePresets.length ) { #> 50 <div class="elementor-control-structure-presets"> 51 <# _.each( morePresets, function( preset ) { #> 52 <div class="elementor-control-structure-preset-wrapper"> 53 <input id="<?php $this->print_control_uid( '{{ preset.key }}' ); ?>" type="radio" name="elementor-control-structure-preset-{{ data._cid }}" data-setting="structure" value="{{ preset.key }}"> 54 <label for="<?php $this->print_control_uid( '{{ preset.key }}' ); ?>" class="elementor-control-structure-preset"> 55 {{{ elementor.presetsFactory.getPresetSVG( preset.preset, 102, 42 ).outerHTML }}} 56 </label> 57 <div class="elementor-control-structure-preset-title">{{{ preset.preset.join( ', ' ) }}}</div> 58 </div> 59 <# } ); #> 60 </div> 61 <# } #> 62 </div> 63 <div class="elementor-control-structure-reset"> 64 <i class="eicon-undo" aria-hidden="true"></i> 65 <?php echo esc_html__( 'Reset', 'elementor' ); ?> 66 </div> 67 </div> 68 <# if ( data.description ) { #> 69 <div class="elementor-control-field-description">{{{ data.description }}}</div> 70 <# } #> 71 <?php 72 } 73 74 /** 75 * Get structure control default settings. 76 * 77 * Retrieve the default settings of the structure control. Used to return the 78 * default settings while initializing the structure control. 79 * 80 * @since 1.0.0 81 * @access protected 82 * 83 * @return array Control default settings. 84 */ 85 protected function get_default_settings() { 86 return [ 87 'separator' => 'none', 88 'label_block' => true, 89 'show_label' => false, 90 ]; 91 } 92 }