PluginProbe ʕ •ᴥ•ʔ
Spider Elements – Premium Elementor Widgets & Addons Library / 1.1.0
Spider Elements – Premium Elementor Widgets & Addons Library v1.1.0
trunk 1.0.0 1.1.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.7.0 1.8.0 1.9.0
spider-elements / widgets / Timeline.php
spider-elements / widgets Last commit date
templates 2 years ago Accordion.php 2 years ago Alerts_Box.php 2 years ago Animated_Heading.php 2 years ago Before_after.php 2 years ago Blog_Grid.php 2 years ago Buttons.php 2 years ago Cheat_sheet.php 2 years ago Counter.php 2 years ago Fullscreen_Slider.php 2 years ago Icon_box.php 2 years ago Instagram.php 2 years ago Integrations.php 2 years ago List_Item.php 2 years ago Marquee_Slides.php 2 years ago Pricing_Table_Switcher.php 2 years ago Pricing_Table_Tabs.php 2 years ago Skill_Showcase.php 2 years ago Tabs.php 2 years ago Team_Carousel.php 2 years ago Testimonial.php 2 years ago Timeline.php 2 years ago Video_Playlist.php 2 years ago Video_Popup.php 2 years ago
Timeline.php
366 lines
1 <?php
2 /**
3 * Use namespace to avoid conflict
4 */
5
6 namespace SPEL\Widgets;
7
8 use Elementor\Widget_Base;
9 use Elementor\Repeater;
10 use Elementor\Controls_Manager;
11 use Elementor\Group_Control_Background;
12 use Elementor\Group_Control_Typography;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 /**
19 * Class Timeline
20 * @package spider\Widgets
21 */
22 class Timeline extends Widget_Base {
23
24 public function get_name() {
25 return 'spe_timeline_widget'; // ID of the widget (Don't change this name)
26 }
27
28
29 public function get_title() {
30 return __( 'Timeline', 'spider-elements' );
31 }
32
33 public function get_icon() {
34 return 'eicon-time-line spel-icon';
35 }
36
37 public function get_categories() {
38 return [ 'spider-elements' ];
39 }
40
41 /**
42 * Name: get_style_depends()
43 * Desc: Register the required CSS dependencies for the frontend.
44 */
45 public function get_style_depends() {
46 return [ 'spel-main' ];
47 }
48
49
50 /**
51 * Name: register_controls()
52 * Desc: Register controls for these widgets
53 * Params: no params
54 * Return: @void
55 * Since: @1.0.0
56 * Package: @spider-elements
57 * Author: spider-themes
58 */
59 protected function register_controls() {
60 $this->elementor_content_control();
61 $this->elementor_style_control();
62 }
63
64 /**
65 * Name: elementor_content_control()
66 * Desc: Register the Content Tab output on the Elementor editor.
67 * Params: no params
68 * Return: @void
69 * Since: @1.0.0
70 * Package: @spider-elements
71 * Author: spider-themes
72 */
73 protected function elementor_content_control() {
74
75 //=======================Timeline Content====================//
76 $this->start_controls_section(
77 'section_timeline',
78 [
79 'label' => __( 'Timeline', 'spider-elements' ),
80 'tab' => Controls_Manager::TAB_CONTENT,
81 ]
82 );
83
84 $repeater = new Repeater();
85
86 $repeater->add_control(
87 'timestamp',
88 [
89 'label' => __( 'Timestamp', 'spider-elements' ),
90 'type' => Controls_Manager::TEXT,
91 'default' => __( '11.05.2013', 'spider-elements' ),
92 'label_block' => true,
93 ]
94 );
95
96 $repeater->add_control(
97 'title',
98 [
99 'label' => __( 'Title', 'spider-elements' ),
100 'type' => Controls_Manager::TEXT,
101 'default' => __( 'Davidson College', 'spider-elements' ),
102 'label_block' => true,
103 ]
104 );
105
106 $repeater->add_control(
107 'location',
108 [
109 'label' => __( 'Location', 'spider-elements' ),
110 'type' => Controls_Manager::TEXT,
111 'default' => __( 'North Carolina', 'spider-elements' ),
112 'label_block' => true,
113 ]
114 );
115
116 $repeater->add_control(
117 'content',
118 [
119 'label' => __( 'Content', 'spider-elements' ),
120 'type' => Controls_Manager::WYSIWYG,
121 'default' => __( 'Vitae adipiscing turpis...', 'spider-elements' ),
122 'show_label' => false,
123 ]
124 );
125
126
127 $this->add_control(
128 'timeline_items',
129 [
130 'label' => __( 'Timeline Items', 'spider-elements' ),
131 'type' => Controls_Manager::REPEATER,
132 'fields' => $repeater->get_controls(),
133 'default' => [
134 [
135 'timestamp' => __( '11.05.2013', 'spider-elements' ),
136 'title' => __( 'Davidson College', 'spider-elements' ),
137 'location' => __( 'North Carolina', 'spider-elements' ),
138 'content' => __( 'Vitae adipiscing turpis...', 'spider-elements' ),
139 ],
140 // Add more default timeline items here...
141 ],
142 'title_field' => '{{{ title }}}',
143 ]
144 );
145
146
147 $this->add_group_control(
148 \Elementor\Group_Control_Background::get_type(),
149 [
150 'name' => 'background',
151 'types' => [ 'classic', 'gradient', ],
152 'selector' => '{{WRAPPER}} .timeline-wrapper .timeline-panel p::after',
153 ]
154 );
155
156 $this->end_controls_section(); //End Timeline Content
157 }
158
159
160 /**
161 * Name: elementor_style_control()
162 * Desc: Register the Style Tab output on the Elementor editor.
163 * Params: no params
164 * Return: @void
165 * Since: @1.0.0
166 * Package: @spider-elements
167 * Author: spider-themes
168 */
169 public function elementor_style_control() {
170
171 //============================= Timeline Content Style =============================//
172 $this->start_controls_section(
173 'timeline_content_style', [
174 'label' => esc_html__( 'Timeline Content', 'spider-elements' ),
175 'tab' => Controls_Manager::TAB_STYLE,
176 ]
177 );
178
179 //=== Timeline Title
180 $this->add_control(
181 'timeline_title', [
182 'label' => __( 'Title', 'spider-elements' ),
183 'type' => Controls_Manager::HEADING,
184 'separator' => 'before',
185 ]
186 );
187
188 $this->add_control(
189 'timeline', [
190 'label' => __( 'Text Color', 'spider-elements' ),
191 'type' => Controls_Manager::COLOR,
192 'selectors' => [
193 '{{WRAPPER}} .timeline-wrapper .timeline-panel h3' => 'color: {{VALUE}};',
194 ],
195 ]
196 );
197
198 $this->add_group_control(
199 Group_Control_Typography::get_type(), [
200 'name' => 'timeline_title_typo',
201 'selector' => '{{WRAPPER}} .timeline-wrapper .timeline-panel h3',
202 ]
203 ); //End TImeline Title
204
205
206 //=== Timeline Location
207 $this->add_control(
208 'timeline_location', [
209 'label' => __( 'Location', 'spider-elements' ),
210 'type' => Controls_Manager::HEADING,
211 'separator' => 'before',
212 ]
213 );
214
215 $this->add_control(
216 'timeline_location_color', [
217 'label' => __( 'Text Color', 'spider-elements' ),
218 'type' => Controls_Manager::COLOR,
219 'selectors' => [
220 '{{WRAPPER}} .timeline-wrapper .timeline-panel span' => 'color: {{VALUE}};',
221 ],
222 ]
223 );
224
225 $this->add_group_control(
226 Group_Control_Typography::get_type(), [
227 'name' => 'timeline_location_typo',
228 'selector' => '{{WRAPPER}} .timeline-wrapper .timeline-panel span',
229 ]
230 ); //End Timeline Location
231
232
233 //=== Timeline Content
234 $this->add_control(
235 'timeline_content', [
236 'label' => __( 'Timeline Content', 'spider-elements' ),
237 'type' => Controls_Manager::HEADING,
238 'separator' => 'before',
239 ]
240 );
241
242 $this->add_control(
243 'timeline_content_color', [
244 'label' => __( 'Text Color', 'spider-elements' ),
245 'type' => Controls_Manager::COLOR,
246 'selectors' => [
247 '{{WRAPPER}} .timeline-wrapper .timeline-panel p' => 'color: {{VALUE}};',
248 ],
249 ]
250 );
251
252 $this->add_group_control(
253 Group_Control_Typography::get_type(), [
254 'name' => 'timeline_content_typo',
255 'selector' => '{{WRAPPER}} .timeline-wrapper .timeline-panel p',
256 ]
257 ); //End Timeline content
258
259
260 //=== Timeline Date Option
261 $this->add_control(
262 'timeline_date', [
263 'label' => __( 'Date', 'spider-elements' ),
264 'type' => Controls_Manager::HEADING,
265 'separator' => 'before',
266 ]
267 );
268
269 $this->add_group_control(
270 \Elementor\Group_Control_Background::get_type(),
271 [
272 'name' => 'timeline_date_bg_color',
273 'types' => [ 'classic', 'gradient' ],
274 'exclude' => [ 'image' ],
275 'selector' => '{{WRAPPER}} .timeline-wrapper .timestamp'
276 ]
277 );
278
279 $this->add_control(
280 'timeline_date_color', [
281 'label' => __( 'Text Color', 'spider-elements' ),
282 'type' => Controls_Manager::COLOR,
283 'selectors' => [
284 '{{WRAPPER}} .timeline-wrapper .timestamp' => 'color: {{VALUE}};',
285 ],
286 ]
287 );
288
289 $this->add_group_control(
290 Group_Control_Typography::get_type(), [
291 'name' => 'timeline_meta_typo',
292 'selector' => '{{WRAPPER}} .timeline-wrapper .timestamp',
293 ]
294 ); //End Timeline Date Option
295
296
297 $this->end_controls_section();
298
299 } //End Timeline Content Style
300
301
302 /**
303 * Name: elementor_render()
304 * Desc: Render the widget output on the frontend.
305 * Params: no params
306 * Return: @void
307 * Since: @1.0.0
308 * Package: @spider-elements
309 * Author: spider-themes
310 */
311 protected function render() {
312 $settings = $this->get_settings_for_display();
313
314 if ( !empty( $settings['timeline_items'] ) ) {
315 echo '<div class="timeline-widget">';
316 $is_inverted = false;
317 foreach ( $settings[ 'timeline_items' ] as $item ) {
318 $timestamp = !empty($item[ 'timestamp' ]) ? $item[ 'timestamp' ] : '';
319 $title = !empty($item[ 'title' ]) ? $item[ 'title' ] : '';
320 $location = !empty($item[ 'location' ]) ? $item[ 'location' ] : '';
321 $content = !empty($item[ 'content' ]) ? $item[ 'content' ] : '';
322 echo '<div class="timeline-wrapper wow fadeInUp' . ($is_inverted ? ' timeline-inverted' : '') . '" data-wow-delay="0.1s">';
323 echo '<div class="timestamp">' . esc_html($timestamp) . '</div>';
324 echo '<div class="timeline-panel">';
325 echo '<h3>' . esc_html($title) . '</h3>';
326 echo '<span>' . esc_html($location) . '</span>';
327 echo spel_kses_post(wpautop($content));
328 echo '</div>';
329 echo '</div>';
330 $is_inverted = !$is_inverted;
331 }
332 echo '</div>';
333 echo '</div>';
334 }
335 }
336 }
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366