Skip to content

Commit 10dc09d

Browse files
Deprecations: Add complex example (#237)
1 parent 16ba450 commit 10dc09d

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed

src/.vuepress/sidebars/deprecations.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module.exports = [
2525
children: [
2626
'simple-example',
2727
'advanced-example',
28+
'complex-example',
2829
]
2930
},
3031
];

src/deprecations/complex-example.md

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Complex Example
2+
3+
<Badge type="tip" vertical="top" text="Elementor Core" /> <Badge type="warning" vertical="top" text="Intermediate" />
4+
5+
In Elementor 3.0, the limited Schemes mechanism had been replaced with [Globals](./../editor-controls/global-style/) which allows users to define limitless colors and typographies. Addons using schemes in their widgets controls should update the code.
6+
7+
## Schemes to Globals
8+
9+
Addon developers should update their code, replacing deprecated Schemes with Globals.
10+
11+
### Typography
12+
13+
```diff
14+
$this->add_group_control(
15+
\Elementor\Group_Control_Typography::get_type(),
16+
[
17+
'name' => 'heading_typography',
18+
- 'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_1,
19+
+ 'global' => [
20+
+ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_PRIMARY,
21+
+ ],
22+
'selector' => '{{WRAPPER}} .heading-class',
23+
]
24+
);
25+
26+
$this->add_group_control(
27+
\Elementor\Group_Control_Typography::get_type(),
28+
[
29+
'name' => 'subheading_typography',
30+
- 'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_2,
31+
+ 'global' => [
32+
+ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_SECONDARY,
33+
+ ],
34+
'selector' => '{{WRAPPER}} .subheading-class',
35+
]
36+
);
37+
38+
$this->add_group_control(
39+
\Elementor\Group_Control_Typography::get_type(),
40+
[
41+
'name' => 'text_typography',
42+
- 'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_3,
43+
+ 'global' => [
44+
+ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_TEXT,
45+
+ ],
46+
'selector' => '{{WRAPPER}} .text-class',
47+
]
48+
);
49+
50+
$this->add_group_control(
51+
\Elementor\Group_Control_Typography::get_type(),
52+
[
53+
'name' => 'accent_typography',
54+
- 'scheme' => \Elementor\Core\Schemes\Typography::TYPOGRAPHY_4,
55+
+ 'global' => [
56+
+ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_ACCENT,
57+
+ ],
58+
'selector' => '{{WRAPPER}} .accent-class',
59+
]
60+
);
61+
```
62+
63+
### Colors
64+
65+
```diff
66+
$this->add_control(
67+
'heading_color',
68+
[
69+
'label' => esc_html__( 'Heading Color', 'textdomain' ),
70+
'type' => \Elementor\Controls_Manager::COLOR,
71+
- 'scheme' => [
72+
- 'type' => \Elementor\Core\Schemes\Color::get_type(),
73+
- 'value' => \Elementor\Core\Schemes\Color::COLOR_1,
74+
- ],
75+
+ 'global' => [
76+
+ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_PRIMARY,
77+
+ ],
78+
'selectors' => [
79+
'{{WRAPPER}} .heading-class' => 'color: {{VALUE}};',
80+
],
81+
]
82+
);
83+
84+
$this->add_control(
85+
'subheading_color',
86+
[
87+
'label' => esc_html__( 'Subheading Color', 'textdomain' ),
88+
'type' => \Elementor\Controls_Manager::COLOR,
89+
- 'scheme' => [
90+
- 'type' => \Elementor\Core\Schemes\Color::get_type(),
91+
- 'value' => \Elementor\Core\Schemes\Color::COLOR_2,
92+
- ],
93+
+ 'global' => [
94+
+ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_SECONDARY,
95+
+ ],
96+
'selectors' => [
97+
'{{WRAPPER}} .subheading-class' => 'color: {{VALUE}};',
98+
],
99+
]
100+
);
101+
102+
$this->add_control(
103+
'text_color',
104+
[
105+
'label' => esc_html__( 'Text Color', 'textdomain' ),
106+
'type' => \Elementor\Controls_Manager::COLOR,
107+
- 'scheme' => [
108+
- 'type' => \Elementor\Core\Schemes\Color::get_type(),
109+
- 'value' => \Elementor\Core\Schemes\Color::COLOR_3,
110+
- ],
111+
+ 'global' => [
112+
+ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_TEXT,
113+
+ ],
114+
'selectors' => [
115+
'{{WRAPPER}} .text-class' => 'color: {{VALUE}};',
116+
],
117+
]
118+
);
119+
120+
$this->add_control(
121+
'accent_color',
122+
[
123+
'label' => esc_html__( 'Accent Color', 'textdomain' ),
124+
'type' => \Elementor\Controls_Manager::COLOR,
125+
- 'scheme' => [
126+
- 'type' => \Elementor\Core\Schemes\Color::get_type(),
127+
- 'value' => \Elementor\Core\Schemes\Color::COLOR_4,
128+
- ],
129+
+ 'global' => [
130+
+ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_ACCENT,
131+
+ ],
132+
'selectors' => [
133+
'{{WRAPPER}} .accent-class' => 'color: {{VALUE}};',
134+
],
135+
]
136+
);
137+
```

0 commit comments

Comments
 (0)