Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/elementor/includes/widgets/spacer.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
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 esc_html__( '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 + protected function is_dynamic_content(): bool {
90 + return false;
91 + }
92 +
93 + /**
94 + * Get style dependencies.
95 + *
96 + * Retrieve the list of style dependencies the widget requires.
97 + *
98 + * @since 3.24.0
99 + * @access public
100 + *
101 + * @return array Widget style dependencies.
102 + */
103 + public function get_style_depends(): array {
104 + return [ 'widget-spacer' ];
105 + }
106 +
107 + public function has_widget_inner_wrapper(): bool {
108 + return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
109 + }
110 +
111 + /**
112 + * Register spacer widget controls.
113 + *
114 + * Adds different input fields to allow the user to change and customize the widget settings.
115 + *
116 + * @since 3.1.0
117 + * @access protected
118 + */
119 + protected function register_controls() {
120 + $this->start_controls_section(
121 + 'section_spacer',
122 + [
123 + 'label' => esc_html__( 'Spacer', 'elementor' ),
124 + ]
125 + );
126 +
127 + $this->add_responsive_control(
128 + 'space',
129 + [
130 + 'label' => esc_html__( 'Space', 'elementor' ),
131 + 'type' => Controls_Manager::SLIDER,
132 + 'default' => [
133 + 'size' => 50,
134 + ],
135 + 'size_units' => [ 'px', 'em', 'rem', 'vh', 'custom' ],
136 + 'range' => [
137 + 'px' => [
138 + 'max' => 600,
139 + ],
140 + 'em' => [
141 + 'max' => 20,
142 + ],
143 + ],
144 + 'render_type' => 'template',
145 + 'selectors' => [
146 + '{{WRAPPER}}' => '--spacer-size: {{SIZE}}{{UNIT}};',
147 + ],
148 + ]
149 + );
150 +
151 + $this->end_controls_section();
152 + }
153 +
154 + /**
155 + * Render spacer widget output on the frontend.
156 + *
157 + * Written in PHP and used to generate the final HTML.
158 + *
159 + * @since 1.0.0
160 + * @access protected
161 + */
162 + protected function render() {
163 + $settings = $this->get_settings_for_display();
164 +
165 + if ( empty( $settings['space'] ) || empty( $settings['space']['size'] ) || 0 === $settings['space']['size'] ) {
166 + return;
167 + }
168 + ?>
169 + <div class="elementor-spacer">
170 + <div class="elementor-spacer-inner"></div>
171 + </div>
172 + <?php
173 + }
174 +
175 + /**
176 + * Render spacer widget output in the editor.
177 + *
178 + * Written as a Backbone JavaScript template and used to generate the live preview.
179 + *
180 + * @since 2.9.0
181 + * @access protected
182 + */
183 + protected function content_template() {
184 + ?>
185 + <#
186 + if ( '' === settings.space || '' === settings.space.size || 0 === settings.space.size ) {
187 + return;
188 + }
189 + #>
190 + <div class="elementor-spacer">
191 + <div class="elementor-spacer-inner"></div>
192 + </div>
193 + <?php
194 + }
195 + }
196 +