PluginProbe
Amedea – Unique Design Elements for Elementor / trunk
Amedea – Unique Design Elements for Elementor vtrunk
trunk 0.0.4.7
amedea / widgets / theme-widgets / marquee.php

marquee.php in Amedea – Unique Design Elements for Elementor trunk, at widgets/theme-widgets/marquee.php

375 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Amedea\Widgets;
4
5
6
7 use \Elementor\Widget_Base;
8
9 use \Elementor\Controls_Manager;
10
11
12
13 /**
14
15 * Elementor
16
17 *
18
19 * Elementor widget
20
21 *
22
23 * @since 1.0.0
24
25 */
26
27 class amedea__marquee extends Widget_Base {
28
29
30
31 /**
32
33 * Retrieve the widget name.
34
35 *
36
37 * @since 1.0.0
38
39 *
40
41 * @access public
42
43 *
44
45 * @return string Widget name.
46
47 */
48
49 public function get_name() {
50
51 return 'marquee';
52
53 }
54
55
56
57 /**
58
59 * Retrieve the widget title.
60
61 *
62
63 * @since 1.0.0
64
65 *
66
67 * @access public
68
69 *
70
71 * @return string Widget title.
72
73 */
74
75 public function get_title() {
76
77 return esc_html__( 'Marquee Text', 'amedea' );
78
79 }
80
81
82
83 /**
84
85 * Retrieve the widget icon.
86
87 *
88
89 * @since 1.0.0
90
91 *
92
93 * @access public
94
95 *
96
97 * @return string Widget icon.
98
99 */
100
101 public function get_icon() {
102
103 return 'eicon-animation-text';
104
105 }
106
107
108
109 /**
110
111 * Retrieve the list of scripts the widget depended on.
112
113 *
114
115 * Used to set scripts dependencies required to run the widget.
116
117 *
118
119 * @since 1.0.0
120
121 *
122
123 * @access public
124
125 *
126
127 * @return array Widget scripts dependencies.
128
129 */
130
131 public function get_script_depends() {
132
133 return [ '' ];
134
135 }
136
137 /**
138
139 * Retrieve the list of categories the widget belongs to.
140
141 *
142
143 * Used to determine where to display the widget in the editor.
144
145 *
146
147 * Note that currently Elementor supports only one category.
148
149 * When multiple categories passed, Elementor uses the first one.
150
151 *
152
153 * @since 1.0.0
154
155 *
156
157 * @access public
158
159 *
160
161 * @return array Widget categories.
162
163 */
164
165 public function get_categories() {
166
167 return [ 'amedea-category' , 'amedea-theme-widgets-category' ];
168
169 }
170
171
172
173
174
175 /**
176
177 * Register the widget controls.
178
179 *
180
181 * Adds different input fields to allow the user to change and customize the widget settings.
182
183 *
184
185 * @since 1.0.0
186
187 *
188
189 * @access protected
190
191 */
192
193 protected function register_controls() {
194
195
196
197 $this->start_controls_section(
198
199 'section_content0',
200
201 [
202
203 'label' => esc_html__( 'Color', 'amedea' ),
204
205 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
206
207 ]
208
209 );
210
211
212
213 $this->add_control(
214
215 'style',
216
217 array(
218
219 'label' => esc_html__('Text Color', 'amedea'),
220
221 'type' => \Elementor\Controls_Manager::SELECT,
222
223 'default' => 'dark',
224
225 'label_block' => true,
226
227 'options' => array(
228
229 'light' => esc_html__('Light', 'amedea'),
230
231 'dark' => esc_html__('Dark', 'amedea'),
232
233 )
234
235 )
236
237 );
238
239
240
241 $this->end_controls_section();
242
243
244
245 $this->start_controls_section(
246
247 'section_content',
248
249 [
250
251 'label' => esc_html__( 'Content', 'amedea' ),
252
253 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
254
255 ]
256
257 );
258
259
260
261 $this->add_control(
262
263 'content',
264
265 [
266
267 'label' => esc_html__( 'Marquee Text', 'amedea' ),
268
269 'type' => \Elementor\Controls_Manager::TEXT,
270
271 'default' => esc_html__( 'Are you ready?', 'amedea' ),
272
273 'placeholder' => esc_html__( 'Type your content here', 'amedea' ),
274
275 ]
276
277 );
278
279
280
281 $this->end_controls_section();
282
283
284
285
286
287 }
288
289
290
291 /**
292
293 * Render the widget output on the frontend.
294
295 *
296
297 * Written in PHP and used to generate the final HTML.
298
299 *
300
301 * @since 1.0.0
302
303 *
304
305 * @access protected
306
307 */
308
309 protected function render() {
310
311 $settings = $this->get_settings_for_display();
312
313 $style = $settings['style'];
314
315
316
317
318
319 ?>
320
321 <main class=<?php switch ($style) {case 'light': default: ?>"light"<?php break; case 'dark': ?>"dark"<?php break;} ?>>
322
323 <div class="marquee__container">
324
325 <div class="marquee">
326
327 <div class="marquee__inner" aria-hidden="true">
328
329 <span><?php echo esc_html($settings['content']); ?></span>
330
331 <span><?php echo esc_html($settings['content']); ?></span>
332
333 <span><?php echo esc_html($settings['content']); ?></span>
334
335 <span><?php echo esc_html($settings['content']); ?></span>
336
337 </div>
338
339 </div>
340
341 </div>
342
343 </main>
344
345 <?php
346
347 }
348
349
350
351 /**
352
353 * Render the widget output in the editor.
354
355 *
356
357 * Written as a Backbone JavaScript template and used to generate the live preview.
358
359 *
360
361 * @since 1.0.0
362
363 *
364
365 * @access protected
366
367 */
368
369 protected function content_template() {}
370
371
372
373 }
374
375