groups
1 year ago
alert.php
2 years ago
animation.php
1 year ago
base-data.php
3 years ago
base-icon-font.php
3 years ago
base-multiple.php
3 years ago
base-ui.php
3 years ago
base-units.php
2 years ago
base.php
3 years ago
box-shadow.php
3 years ago
button.php
3 years ago
choose.php
3 years ago
code.php
3 years ago
color.php
3 years ago
date-time.php
3 years ago
deprecated-notice.php
3 years ago
dimensions.php
3 years ago
divider.php
2 years ago
exit-animation.php
1 year ago
font.php
3 years ago
gallery.php
1 year ago
gaps.php
2 years ago
heading.php
3 years ago
hidden.php
3 years ago
hover-animation.php
1 year ago
icon.php
2 years ago
icons.php
2 years ago
image-dimensions.php
3 years ago
media.php
1 year ago
notice.php
1 year ago
number.php
3 years ago
popover-toggle.php
3 years ago
raw-html.php
3 years ago
repeater.php
1 year ago
section.php
2 years ago
select.php
3 years ago
select2.php
2 years ago
slider.php
3 years ago
structure.php
2 years ago
switcher.php
3 years ago
tab.php
2 years ago
tabs.php
2 years ago
text-shadow.php
3 years ago
text.php
3 years ago
textarea.php
3 years ago
url.php
1 year ago
wp-widget.php
3 years ago
wysiwyg.php
3 years ago
number.php
81 lines
| 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 | } |
| 81 |