PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.3
Elementor Website Builder – more than just a page builder v4.2.3
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / includes / controls / gaps.php

gaps.php in Elementor Website Builder – more than just a page builder 4.2.3, at includes/controls/gaps.php

78 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 class Control_Gaps extends Control_Dimensions {
17 /**
18 * Get gap control type.
19 *
20 * Retrieve the control type, in this case `gap`.
21 *
22 * @since 3.13.0
23 * @access public
24 *
25 * @return string Control type.
26 */
27 public function get_type() {
28 return 'gaps';
29 }
30
31 /**
32 * Get gap control default values.
33 *
34 * Retrieve the default value of the gap control. Used to return the default
35 * values while initializing the gap control.
36 *
37 * @since 3.13.0
38 * @access public
39 *
40 * @return array Control default value.
41 */
42 public function get_default_value() {
43 return [
44 'column' => '',
45 'row' => '',
46 'isLinked' => true,
47 'unit' => 'px',
48 ];
49 }
50
51 public function get_singular_name() {
52 return 'gap';
53 }
54
55 protected function get_dimensions() {
56 return [
57 'column' => esc_html__( 'Column', 'elementor' ),
58 'row' => esc_html__( 'Row', 'elementor' ),
59 ];
60 }
61
62 public function get_value( $control, $settings ) {
63 $value = parent::get_value( $control, $settings );
64
65 // BC for any old Slider control values.
66 if ( $this->should_update_gaps_values( $value ) ) {
67 $value['column'] = strval( $value['size'] );
68 $value['row'] = strval( $value['size'] );
69 }
70
71 return $value;
72 }
73
74 private function should_update_gaps_values( $value ) {
75 return isset( $value['size'] ) && '' !== $value['size'] && '' === $value['column'];
76 }
77 }
78