PluginProbe
Borderless – Addons and Templates for Elementor / 1.6.1
Borderless – Addons and Templates for Elementor v1.6.1
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 78 releases
borderless / modules / elementor / widgets / marquee-text.php

marquee-text.php in Borderless – Addons and Templates for Elementor 1.6.1, at modules/elementor/widgets/marquee-text.php

331 lines 10.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Borderless\Widgets;
4
5 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
7 use Elementor\Widget_Base;
8 use Elementor\Controls_Manager;
9 use Elementor\Group_Control_Border;
10 use Elementor\Group_Control_Box_Shadow;
11 use Elementor\Group_Control_Image_Size;
12 use \Elementor\Group_Control_Typography;
13 use \Elementor\Group_Control_Background;
14 use \Elementor\Core\Kits\Documents\Tabs\Global_Typography;
15 use \Elementor\Repeater;
16 use Elementor\Utils;
17
18 class Marquee_Text extends Widget_Base {
19
20 public function get_name() {
21 return 'borderless-elementor-marquee-text';
22 }
23
24 public function get_title() {
25 return 'Marquee Text';
26 }
27
28 public function get_icon() {
29 return 'borderless-icon-marquee-text';
30 }
31
32 public function get_categories() {
33 return [ 'borderless' ];
34 }
35
36 public function get_style_depends() {
37 return [ 'borderless-elementor-style' ];
38 }
39
40 public function get_script_depends() {
41 return [ 'borderless-elementor-marquee-script' ];
42 }
43
44 protected function _register_controls() {
45
46 /*-----------------------------------------------------------------------------------*/
47 /* *. Marquee Text - Content
48 /*-----------------------------------------------------------------------------------*/
49
50 $this->start_controls_section(
51 'borderless_elementor_section_marquee_text_content',
52 [
53 'label' => esc_html__( 'Content', 'borderless' ),
54 'tab' => Controls_Manager::TAB_CONTENT,
55 ]
56 );
57
58 $repeater = new Repeater();
59
60 $repeater->add_control(
61 'borderless_elementor_marquee_item',
62 [
63 'label' => esc_html__( 'Content', 'borderless'),
64 'type' => Controls_Manager::TEXT,
65 'label_block' => true,
66 'dynamic' => [ 'active' => true ]
67 ]
68 );
69
70 $this->add_control(
71 'borderless_elementor_marquee_item_strings',
72 [
73 'type' => Controls_Manager::REPEATER,
74 'show_label' => true,
75 'fields' => $repeater->get_controls(),
76 'title_field' => '{{ borderless_elementor_marquee_item }}',
77 'default' => [
78 ['borderless_elementor_marquee_item' => esc_html__('Item #1', 'borderless')],
79 ['borderless_elementor_marquee_item' => esc_html__('Item #2', 'borderless')],
80 ['borderless_elementor_marquee_item' => esc_html__('Item #3', 'borderless')],
81 ['borderless_elementor_marquee_item' => esc_html__('Item #4', 'borderless')],
82 ['borderless_elementor_marquee_item' => esc_html__('Item #5', 'borderless')],
83 ['borderless_elementor_marquee_item' => esc_html__('Item #6', 'borderless')],
84 ['borderless_elementor_marquee_item' => esc_html__('Item #7', 'borderless')],
85 ['borderless_elementor_marquee_item' => esc_html__('Item #8', 'borderless')],
86 ['borderless_elementor_marquee_item' => esc_html__('Item #9', 'borderless')],
87 ['borderless_elementor_marquee_item' => esc_html__('Item #10', 'borderless')],
88 ],
89 ]
90 );
91
92 $this->end_controls_section();
93
94 /*-----------------------------------------------------------------------------------*/
95 /* *. Marquee Text/Settings - Content
96 /*-----------------------------------------------------------------------------------*/
97
98 $this->start_controls_section(
99 'borderless_elementor_section_marquee_text_settings',
100 [
101 'label' => esc_html__( 'Settings', 'borderless' ),
102 'tab' => Controls_Manager::TAB_CONTENT,
103 ]
104 );
105
106 $this->add_control(
107 'borderless_elementor_marquee_text_start_visible',
108 [
109 'label' => __( 'Start Visible', 'borderless' ),
110 'type' => \Elementor\Controls_Manager::SWITCHER,
111 'return_value' => 'true',
112 'default' => 'true',
113 ]
114 );
115
116 $this->add_control(
117 'borderless_elementor_marquee_text_duplicated',
118 [
119 'label' => __( 'Duplicated', 'borderless' ),
120 'type' => \Elementor\Controls_Manager::SWITCHER,
121 'return_value' => 'true',
122 'default' => 'true',
123 ]
124 );
125
126 $this->add_control(
127 'borderless_elementor_marquee_text_pause_on_hover',
128 [
129 'label' => __( 'Pause On Hover', 'borderless' ),
130 'type' => \Elementor\Controls_Manager::SWITCHER,
131 'return_value' => 'true',
132 'default' => 'false',
133 ]
134 );
135
136 $this->add_control(
137 'borderless_elementor_marquee_text_direction',
138 [
139 'label' => __( 'Direction', 'borderless' ),
140 'type' => \Elementor\Controls_Manager::SELECT,
141 'default' => 'left',
142 'options' => [
143 'left' => __( 'Left', 'borderless' ),
144 'right' => __( 'Right', 'borderless' ),
145 ],
146 ]
147 );
148
149 $this->add_control(
150 'borderless_elementor_marquee_text_duration',
151 [
152 'label' => __( 'Duration', 'borderless' ),
153 'type' => \Elementor\Controls_Manager::NUMBER,
154 'min' => 1000,
155 'max' => 100000,
156 'step' => 100,
157 'default' => 5000,
158 ]
159 );
160
161 $this->add_responsive_control(
162 'borderless_elementor_marquee_text_gap',
163 [
164 'label' => __( 'Gap', 'borderless' ),
165 'type' => \Elementor\Controls_Manager::NUMBER,
166 'min' => 0,
167 'max' => 99999,
168 'step' => 1,
169 'default' => 50,
170 'selectors' => [
171 '{{WRAPPER}} .borderless-elementor-marquee-text .js-marquee' => 'gap: {{VALUE}}px',
172 ],
173 ]
174 );
175
176 $this->add_control(
177 'borderless_elementor_marquee_text_delay_before_start',
178 [
179 'label' => __( 'Delay Before Start', 'borderless' ),
180 'type' => \Elementor\Controls_Manager::NUMBER,
181 'min' => 0,
182 'max' => 99999,
183 'step' => 1,
184 'default' => 0,
185 ]
186 );
187
188 $this->end_controls_section();
189
190 /*-----------------------------------------------------------------------------------*/
191 /* *. Marquee Text - Style
192 /*-----------------------------------------------------------------------------------*/
193
194 $this->start_controls_section(
195 'borderless_elementor_section_marquee_text_style',
196 [
197 'label' => esc_html__( 'Marquee Text', 'borderless'),
198 'tab' => Controls_Manager::TAB_STYLE
199 ]
200 );
201
202 $this->add_group_control(
203 Group_Control_Typography::get_type(),
204 [
205 'name' => 'borderless_elementor_marquee_text_typography',
206 'label' => __('Typography', 'borderless'),
207 'global' => [
208 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
209 ],
210 'selector' => '{{WRAPPER}} .borderless-elementor-marquee-text *',
211 ]
212 );
213
214 $this->add_group_control(
215 \Elementor\Group_Control_Text_Shadow::get_type(),
216 [
217 'name' => 'borderless_elementor_marquee_text_shadow',
218 'label' => __( 'Text Shadow', 'borderless' ),
219 'selector' => '{{WRAPPER}} .borderless-elementor-marquee-text *',
220 ]
221 );
222
223 $this->add_control(
224 'borderless_elementor_marquee_text_color',
225 [
226 'label' => __( 'Color', 'borderless' ),
227 'type' => Controls_Manager::COLOR,
228 'selectors' => [
229 '{{WRAPPER}} .borderless-elementor-marquee-text *' => 'color: {{VALUE}};',
230 ],
231 ]
232 );
233
234 $this->add_group_control(
235 Group_Control_Background::get_type(),
236 [
237 'name' => 'borderless_elementor_marquee_text_background',
238 'label' => __( 'Background', 'borderless' ),
239 'types' => [ 'classic', 'gradient' ],
240 'selector' => '{{WRAPPER}} .borderless-elementor-marquee-text .js-marquee .borderless-elementor-marquee-text-item',
241 ]
242 );
243
244 $this->add_responsive_control(
245 'borderless_elementor_marquee_text_padding',
246 [
247 'label' => esc_html__( 'Padding', 'borderless'),
248 'type' => Controls_Manager::DIMENSIONS,
249 'size_units' => [ 'px', 'em', '%', 'rem' ],
250 'selectors' => [
251 '{{WRAPPER}} .borderless-elementor-marquee-text .js-marquee .borderless-elementor-marquee-text-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
252 ],
253 ]
254 );
255
256 $this->add_responsive_control(
257 'borderless_elementor_marquee_text_margin',
258 [
259 'label' => esc_html__( 'Margin', 'borderless'),
260 'type' => Controls_Manager::DIMENSIONS,
261 'size_units' => [ 'px', 'em', '%', 'rem' ],
262 'selectors' => [
263 '{{WRAPPER}} .borderless-elementor-marquee-text .js-marquee .borderless-elementor-marquee-text-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
264 ],
265 ]
266 );
267
268 $this->add_group_control(
269 Group_Control_Border::get_type(),
270 [
271 'name' => 'borderless_elementor_marquee_text_border',
272 'label' => esc_html__( 'Border', 'borderless'),
273 'selector' => '{{WRAPPER}} .borderless-elementor-marquee-text .js-marquee .borderless-elementor-marquee-text-item',
274 ]
275 );
276
277 $this->add_responsive_control(
278 'borderless_elementor_marquee_text_radius',
279 [
280 'label' => esc_html__( 'Border Radius', 'borderless'),
281 'type' => Controls_Manager::DIMENSIONS,
282 'selectors' => [
283 '{{WRAPPER}} .borderless-elementor-marquee-text .js-marquee .borderless-elementor-marquee-text-item' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
284 ],
285 ]
286 );
287
288 $this->add_group_control(
289 Group_Control_Box_Shadow::get_type(),
290 [
291 'name' => 'borderless_elementor_marquee_text_box_shadow',
292 'exclude' => [
293 'box_shadow_position',
294 ],
295 'selector' => '{{WRAPPER}} .borderless-elementor-marquee-text .js-marquee .borderless-elementor-marquee-text-item',
296 ]
297 );
298
299 $this->end_controls_section();
300 }
301
302 protected function render() {
303
304 $settings = $this->get_settings_for_display();
305
306 $this->add_render_attribute( 'marquee-text', 'data-direction', $settings['borderless_elementor_marquee_text_direction'] );
307 $this->add_render_attribute( 'marquee-text', 'data-duration', $settings['borderless_elementor_marquee_text_duration'] );
308 $this->add_render_attribute( 'marquee-text', 'data-delayBeforeStart', $settings['borderless_elementor_marquee_text_delay_before_start'] );
309 $this->add_render_attribute( 'marquee-text', 'data-gap', $settings['borderless_elementor_marquee_text_gap'] );
310 $this->add_render_attribute( 'marquee-text', 'data-startVisible', $settings['borderless_elementor_marquee_text_start_visible'] );
311 $this->add_render_attribute( 'marquee-text', 'data-duplicated', $settings['borderless_elementor_marquee_text_duplicated'] );
312 $this->add_render_attribute( 'marquee-text', 'data-pauseOnHover', $settings['borderless_elementor_marquee_text_pause_on_hover'] );
313
314 ?>
315
316 <div class="borderless-elementor-marquee-text-widget">
317 <div class="borderless-elementor-marquee-text" <?php echo $this->get_render_attribute_string( 'marquee-text' ) ?>>
318 <?php foreach ( $settings['borderless_elementor_marquee_item_strings'] as $marquee_string ) { echo '<span class="borderless-elementor-marquee-text-item">'.wp_kses( ( $marquee_string['borderless_elementor_marquee_item'] ), true ).'</span>'; } ?>
319 </div>
320 </div>
321
322 <?php
323
324 }
325
326 protected function _content_template() {
327
328 }
329
330
331 }