PluginProbe
Elementor Website Builder – more than just a page builder / 3.2.3
Elementor Website Builder – more than just a page builder v3.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 / widgets / spacer.php

spacer.php in Elementor Website Builder – more than just a page builder 3.2.3, at includes/widgets/spacer.php

174 lines 3.0 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 spacer widget.
10 *
11 * Elementor widget that inserts a space that divides various elements.
12 *
13 * @since 1.0.0
14 */
15 class Widget_Spacer extends Widget_Base {
16
17 /**
18 * Get widget name.
19 *
20 * Retrieve spacer widget name.
21 *
22 * @since 1.0.0
23 * @access public
24 *
25 * @return string Widget name.
26 */
27 public function get_name() {
28 return 'spacer';
29 }
30
31 /**
32 * Get widget title.
33 *
34 * Retrieve spacer widget title.
35 *
36 * @since 1.0.0
37 * @access public
38 *
39 * @return string Widget title.
40 */
41 public function get_title() {
42 return __( 'Spacer', 'elementor' );
43 }
44
45 /**
46 * Get widget icon.
47 *
48 * Retrieve spacer widget icon.
49 *
50 * @since 1.0.0
51 * @access public
52 *
53 * @return string Widget icon.
54 */
55 public function get_icon() {
56 return 'eicon-spacer';
57 }
58
59 /**
60 * Get widget categories.
61 *
62 * Retrieve the list of categories the spacer widget belongs to.
63 *
64 * Used to determine where to display the widget in the editor.
65 *
66 * @since 1.0.0
67 * @access public
68 *
69 * @return array Widget categories.
70 */
71 public function get_categories() {
72 return [ 'basic' ];
73 }
74
75 /**
76 * Get widget keywords.
77 *
78 * Retrieve the list of keywords the widget belongs to.
79 *
80 * @since 2.1.0
81 * @access public
82 *
83 * @return array Widget keywords.
84 */
85 public function get_keywords() {
86 return [ 'space' ];
87 }
88
89 /**
90 * Register spacer widget controls.
91 *
92 * Adds different input fields to allow the user to change and customize the widget settings.
93 *
94 * @since 3.1.0
95 * @access protected
96 */
97 protected function register_controls() {
98 $this->start_controls_section(
99 'section_spacer',
100 [
101 'label' => __( 'Spacer', 'elementor' ),
102 ]
103 );
104
105 $this->add_responsive_control(
106 'space',
107 [
108 'label' => __( 'Space', 'elementor' ),
109 'type' => Controls_Manager::SLIDER,
110 'default' => [
111 'size' => 50,
112 ],
113 'size_units' => [ 'px', 'vh', 'em' ],
114 'range' => [
115 'px' => [
116 'min' => 10,
117 'max' => 600,
118 ],
119 'em' => [
120 'min' => 0.1,
121 'max' => 20,
122 ],
123 ],
124 'selectors' => [
125 '{{WRAPPER}} .elementor-spacer-inner' => 'height: {{SIZE}}{{UNIT}};',
126 ],
127 ]
128 );
129
130 $this->add_control(
131 'view',
132 [
133 'label' => __( 'View', 'elementor' ),
134 'type' => Controls_Manager::HIDDEN,
135 'default' => 'traditional',
136 ]
137 );
138
139 $this->end_controls_section();
140 }
141
142 /**
143 * Render spacer widget output on the frontend.
144 *
145 * Written in PHP and used to generate the final HTML.
146 *
147 * @since 1.0.0
148 * @access protected
149 */
150 protected function render() {
151 ?>
152 <div class="elementor-spacer">
153 <div class="elementor-spacer-inner"></div>
154 </div>
155 <?php
156 }
157
158 /**
159 * Render spacer widget output in the editor.
160 *
161 * Written as a Backbone JavaScript template and used to generate the live preview.
162 *
163 * @since 2.9.0
164 * @access protected
165 */
166 protected function content_template() {
167 ?>
168 <div class="elementor-spacer">
169 <div class="elementor-spacer-inner"></div>
170 </div>
171 <?php
172 }
173 }
174