number.php (2139B)
1 <?php 2 namespace Elementor; 3 4 use Elementor\Modules\DynamicTags\Module as TagsModule; 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly. 8 } 9 10 /** 11 * Elementor number control. 12 * 13 * A base control for creating a number control. Displays a simple number input. 14 * 15 * @since 1.0.0 16 */ 17 class Control_Number extends Base_Data_Control { 18 19 /** 20 * Get number control type. 21 * 22 * Retrieve the control type, in this case `number`. 23 * 24 * @since 1.0.0 25 * @access public 26 * 27 * @return string Control type. 28 */ 29 public function get_type() { 30 return 'number'; 31 } 32 33 /** 34 * Get number control default settings. 35 * 36 * Retrieve the default settings of the number control. Used to return the 37 * default settings while initializing the number control. 38 * 39 * @since 1.5.0 40 * @access protected 41 * 42 * @return array Control default settings. 43 */ 44 protected function get_default_settings() { 45 return [ 46 'min' => '', 47 'max' => '', 48 'step' => '', 49 'placeholder' => '', 50 'title' => '', 51 'dynamic' => [ 52 'categories' => [ TagsModule::NUMBER_CATEGORY ], 53 ], 54 ]; 55 } 56 57 /** 58 * Render number control output in the editor. 59 * 60 * Used to generate the control HTML in the editor using Underscore JS 61 * template. The variables for the class are available using `data` JS 62 * object. 63 * 64 * @since 1.0.0 65 * @access public 66 */ 67 public function content_template() { 68 ?> 69 <div class="elementor-control-field"> 70 <label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label> 71 <div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper"> 72 <input id="<?php $this->print_control_uid(); ?>" type="number" min="{{ data.min }}" max="{{ data.max }}" step="{{ data.step }}" class="tooltip-target elementor-control-tag-area elementor-control-unit-2" data-tooltip="{{ data.title }}" title="{{ data.title }}" data-setting="{{ data.name }}" placeholder="{{ view.getControlPlaceholder() }}" /> 73 </div> 74 </div> 75 <# if ( data.description ) { #> 76 <div class="elementor-control-field-description">{{{ data.description }}}</div> 77 <# } #> 78 <?php 79 } 80 }