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
gaps.php
79 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | exit; // Exit if accessed directly. |
| 6 | } |
| 7 | |
| 8 | /** |
| 9 | * Elementor gap control. |
| 10 | * |
| 11 | * A base control for creating a gap control. Displays input fields for two values, |
| 12 | * row/column, height/width and the option to link them together. |
| 13 | * |
| 14 | * @since 3.13.0 |
| 15 | */ |
| 16 | |
| 17 | class Control_Gaps extends Control_Dimensions { |
| 18 | /** |
| 19 | * Get gap control type. |
| 20 | * |
| 21 | * Retrieve the control type, in this case `gap`. |
| 22 | * |
| 23 | * @since 3.13.0 |
| 24 | * @access public |
| 25 | * |
| 26 | * @return string Control type. |
| 27 | */ |
| 28 | public function get_type() { |
| 29 | return 'gaps'; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Get gap control default values. |
| 34 | * |
| 35 | * Retrieve the default value of the gap control. Used to return the default |
| 36 | * values while initializing the gap control. |
| 37 | * |
| 38 | * @since 3.13.0 |
| 39 | * @access public |
| 40 | * |
| 41 | * @return array Control default value. |
| 42 | */ |
| 43 | public function get_default_value() { |
| 44 | return [ |
| 45 | 'column' => '', |
| 46 | 'row' => '', |
| 47 | 'isLinked' => true, |
| 48 | 'unit' => 'px', |
| 49 | ]; |
| 50 | } |
| 51 | |
| 52 | public function get_singular_name() { |
| 53 | return 'gap'; |
| 54 | } |
| 55 | |
| 56 | protected function get_dimensions() { |
| 57 | return [ |
| 58 | 'column' => esc_html__( 'Column', 'elementor' ), |
| 59 | 'row' => esc_html__( 'Row', 'elementor' ), |
| 60 | ]; |
| 61 | } |
| 62 | |
| 63 | public function get_value( $control, $settings ) { |
| 64 | $value = parent::get_value( $control, $settings ); |
| 65 | |
| 66 | // BC for any old Slider control values. |
| 67 | if ( $this->should_update_gaps_values( $value ) ) { |
| 68 | $value['column'] = strval( $value['size'] ); |
| 69 | $value['row'] = strval( $value['size'] ); |
| 70 | } |
| 71 | |
| 72 | return $value; |
| 73 | } |
| 74 | |
| 75 | private function should_update_gaps_values( $value ) { |
| 76 | return isset( $value['size'] ) && '' !== $value['size'] && '' === $value['column']; |
| 77 | } |
| 78 | } |
| 79 |