This repository was archived by the owner on Apr 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRainbowDivider.php
122 lines (108 loc) · 3.15 KB
/
RainbowDivider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
namespace MEPSI\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
if (!defined('ABSPATH')) {
exit;
}
class RainbowDivider extends Widget_Base
{
public static $slug = 'rainbow-divider';
public function get_name()
{
return self::$slug;
}
public function get_title()
{
return __('Rainbow Divider', self::$slug);
}
public function get_icon()
{
return 'eicon-divider';
}
public function get_categories()
{
return [ 'mepsi' ];
}
public function get_style_depends()
{
return [ 'rainbow-divider' ];
}
protected function _register_controls()
{
$this->start_controls_section(
'settings_section',
[
'label' => __('Settings', 'mepsi'),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_responsive_control(
'width',
[
'label' => __('Divider Width', 'mepsi'),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 100,
'unit' => '%',
],
'tablet_default' => [
'size' => 100,
'unit' => '%',
],
'mobile_default' => [
'size' => 100,
'unit' => '%',
],
'size_units' => [ '%', 'px', 'vw' ],
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
'px' => [
'min' => 1,
'max' => 1000,
],
'vw' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .rainbow-divider' => 'width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'content_align',
[
'label' => __('Alignment', 'mepsi'),
'type' => \Elementor\Controls_Manager::CHOOSE,
'default' => 'center',
'options' => [
'left' => [
'title' => __('Left', 'mepsi'),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => __('Center', 'mepsi'),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => __('Right', 'mepsi'),
'icon' => 'fa fa-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .rainbow-divider' => 'margin: 0 auto; margin-{{VALUE}}: 0;',
],
]
);
$this->end_controls_section();
}
protected function render()
{
echo '<div class="rainbow-divider"></div>';
}
}