PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.3
4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 All 201 releases
← All changes | includes/Editors/Elementor/Widget/Title.php +240 -245 3.4.2 → 4.9.3 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2 namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget;
3 3
4 4 if ( ! defined( 'ABSPATH' ) ) {
5 - exit; // Exit if accessed directly
5 + exit; // Exit if accessed directly
6 6 }
7 7
8 8 use ElementorPro\Plugin;
9 9 use Elementor\Core\Schemes;
@@ -13,278 +13,273 @@
13 13 use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget;
14 14 use ElementorPro\Base\Base_Widget_Trait as BaseWidgetTrait;
15 15
16 16 class Title extends BaseWidget {
17 - use BaseWidgetTrait;
17 + use BaseWidgetTrait;
18 18
19 - public $view_wrapper = 'betterdocs-entry-title';
19 + public $view_wrapper = 'betterdocs-entry-title';
20 20
21 - public function get_name() {
22 - return 'betterdocs-title';
23 - }
21 + public function get_name() {
22 + return 'betterdocs-title';
23 + }
24 24
25 - public function get_title() {
26 - return __( 'Doc Title', 'betterdocs' );
27 - }
25 + public function get_title() {
26 + return __( 'Doc Title', 'betterdocs' );
27 + }
28 28
29 - public function get_icon() {
30 - return 'betterdocs-icon-title';
31 - }
29 + public function get_icon() {
30 + return 'betterdocs-icon-title';
31 + }
32 32
33 - public function get_categories() {
34 - return ['betterdocs-elements-single'];
35 - }
33 + public function get_categories() {
34 + return [ 'betterdocs-elements-single' ];
35 + }
36 36
37 - public function get_keywords() {
38 - return ['betterdocs-elements', 'title', 'heading', 'betterdocs', 'docs'];
39 - }
37 + public function get_keywords() {
38 + return [ 'betterdocs-elements', 'title', 'heading', 'betterdocs', 'docs' ];
39 + }
40 40
41 - public function get_custom_help_url() {
42 - return 'https://betterdocs.co/docs/single-doc-in-elementor';
43 - }
41 + public function get_custom_help_url() {
42 + return 'https://betterdocs.co/docs/single-doc-in-elementor';
43 + }
44 44
45 - protected function register_controls() {
46 - $this->start_controls_section(
47 - 'section_title',
48 - [
49 - 'label' => __( 'Title', 'betterdocs' )
50 - ]
51 - );
45 + protected function register_controls() {
46 + $this->start_controls_section(
47 + 'section_title',
48 + [
49 + 'label' => __( 'Title', 'betterdocs' )
50 + ]
51 + );
52 52
53 - $this->add_control(
54 - 'title',
55 - [
56 - 'label' => __( 'Title', 'betterdocs' ),
57 - 'type' => Controls_Manager::TEXTAREA,
58 - 'dynamic' => [
59 - 'active' => true
60 - ],
61 - 'placeholder' => __( 'Enter your title', 'betterdocs' ),
62 - 'default' => __( 'Add Your Heading Text Here', 'betterdocs' )
63 - ]
64 - );
53 + $this->add_control(
54 + 'title',
55 + [
56 + 'label' => __( 'Title', 'betterdocs' ),
57 + 'type' => Controls_Manager::TEXTAREA,
58 + 'dynamic' => [
59 + 'active' => true
60 + ],
61 + 'placeholder' => __( 'Enter your title', 'betterdocs' ),
62 + 'default' => __( 'Add Your Heading Text Here', 'betterdocs' )
63 + ]
64 + );
65 65
66 - $this->add_control(
67 - 'link',
68 - [
69 - 'label' => __( 'Link', 'betterdocs' ),
70 - 'type' => Controls_Manager::URL,
71 - 'dynamic' => [
72 - 'active' => true
73 - ],
74 - 'default' => [
75 - 'url' => ''
76 - ],
77 - 'separator' => 'before'
78 - ]
79 - );
66 + $this->add_control(
67 + 'link',
68 + [
69 + 'label' => __( 'Link', 'betterdocs' ),
70 + 'type' => Controls_Manager::URL,
71 + 'dynamic' => [
72 + 'active' => true
73 + ],
74 + 'default' => [
75 + 'url' => ''
76 + ],
77 + 'separator' => 'before'
78 + ]
79 + );
80 80
81 - $this->add_control(
82 - 'header_size',
83 - [
84 - 'label' => __( 'HTML Tag', 'betterdocs' ),
85 - 'type' => Controls_Manager::SELECT,
86 - 'options' => [
87 - 'h1' => 'H1',
88 - 'h2' => 'H2',
89 - 'h3' => 'H3',
90 - 'h4' => 'H4',
91 - 'h5' => 'H5',
92 - 'h6' => 'H6',
93 - 'div' => 'div',
94 - 'span' => 'span',
95 - 'p' => 'p'
96 - ],
97 - 'default' => 'h2'
98 - ]
99 - );
81 + $this->add_control(
82 + 'header_size',
83 + [
84 + 'label' => __( 'HTML Tag', 'betterdocs' ),
85 + 'type' => Controls_Manager::SELECT,
86 + 'options' => [
87 + 'h1' => 'H1',
88 + 'h2' => 'H2',
89 + 'h3' => 'H3',
90 + 'h4' => 'H4',
91 + 'h5' => 'H5',
92 + 'h6' => 'H6',
93 + 'div' => 'div',
94 + 'span' => 'span',
95 + 'p' => 'p'
96 + ],
97 + 'default' => 'h2'
98 + ]
99 + );
100 100
101 - $this->add_responsive_control(
102 - 'align',
103 - [
104 - 'label' => __( 'Alignment', 'betterdocs' ),
105 - 'type' => Controls_Manager::CHOOSE,
106 - 'options' => [
107 - 'left' => [
108 - 'title' => __( 'Left', 'betterdocs' ),
109 - 'icon' => 'eicon-text-align-left'
110 - ],
111 - 'center' => [
112 - 'title' => __( 'Center', 'betterdocs' ),
113 - 'icon' => 'eicon-text-align-center'
114 - ],
115 - 'right' => [
116 - 'title' => __( 'Right', 'betterdocs' ),
117 - 'icon' => 'eicon-text-align-right'
118 - ],
119 - 'justify' => [
120 - 'title' => __( 'Justified', 'betterdocs' ),
121 - 'icon' => 'eicon-text-align-justify'
122 - ]
123 - ],
124 - 'default' => '',
125 - 'selectors' => [
126 - '{{WRAPPER}}' => 'text-align: {{VALUE}};'
127 - ]
128 - ]
129 - );
101 + $this->add_responsive_control(
102 + 'align',
103 + [
104 + 'label' => __( 'Alignment', 'betterdocs' ),
105 + 'type' => Controls_Manager::CHOOSE,
106 + 'options' => [
107 + 'left' => [
108 + 'title' => __( 'Left', 'betterdocs' ),
109 + 'icon' => 'eicon-text-align-left'
110 + ],
111 + 'center' => [
112 + 'title' => __( 'Center', 'betterdocs' ),
113 + 'icon' => 'eicon-text-align-center'
114 + ],
115 + 'right' => [
116 + 'title' => __( 'Right', 'betterdocs' ),
117 + 'icon' => 'eicon-text-align-right'
118 + ],
119 + 'justify' => [
120 + 'title' => __( 'Justified', 'betterdocs' ),
121 + 'icon' => 'eicon-text-align-justify'
122 + ]
123 + ],
124 + 'default' => '',
125 + 'selectors' => [
126 + '{{WRAPPER}}' => 'text-align: {{VALUE}};'
127 + ]
128 + ]
129 + );
130 130
131 - $this->add_control(
132 - 'view',
133 - [
134 - 'label' => __( 'View', 'betterdocs' ),
135 - 'type' => Controls_Manager::HIDDEN,
136 - 'default' => 'traditional'
137 - ]
138 - );
131 + $this->add_control(
132 + 'view',
133 + [
134 + 'label' => __( 'View', 'betterdocs' ),
135 + 'type' => Controls_Manager::HIDDEN,
136 + 'default' => 'traditional'
137 + ]
138 + );
139 139
140 - $this->end_controls_section();
140 + $this->end_controls_section();
141 141
142 - $this->start_controls_section(
143 - 'section_title_style',
144 - [
145 - 'label' => __( 'Title', 'betterdocs' ),
146 - 'tab' => Controls_Manager::TAB_STYLE
147 - ]
148 - );
142 + $this->start_controls_section(
143 + 'section_title_style',
144 + [
145 + 'label' => __( 'Title', 'betterdocs' ),
146 + 'tab' => Controls_Manager::TAB_STYLE
147 + ]
148 + );
149 149
150 - $this->add_control(
151 - 'title_color',
152 - [
153 - 'label' => __( 'Text Color', 'betterdocs' ),
154 - 'type' => Controls_Manager::COLOR,
155 - 'scheme' => [
156 - 'type' => Schemes\Color::get_type(),
157 - 'value' => Schemes\Color::COLOR_1
158 - ],
159 - 'selectors' => [
160 - '{{WRAPPER}} .betterdocs-entry-title, .betterdocs-entry-title a' => 'color: {{VALUE}};'
161 - ]
162 - ]
163 - );
150 + $this->add_control(
151 + 'title_color',
152 + [
153 + 'label' => __( 'Text Color', 'betterdocs' ),
154 + 'type' => Controls_Manager::COLOR,
155 + 'selectors' => [
156 + '{{WRAPPER}} .betterdocs-entry-title, .betterdocs-entry-title a' => 'color: {{VALUE}};'
157 + ]
158 + ]
159 + );
164 160
165 - $this->add_group_control(
166 - Group_Control_Typography::get_type(),
167 - [
168 - 'name' => 'typography',
169 - 'scheme' => Schemes\Typography::TYPOGRAPHY_1,
170 - 'selector' => '{{WRAPPER}} .betterdocs-entry-title, .betterdocs-entry-title a'
171 - ]
172 - );
161 + $this->add_group_control(
162 + Group_Control_Typography::get_type(),
163 + [
164 + 'name' => 'typography',
165 + 'selector' => '{{WRAPPER}} .betterdocs-entry-title, .betterdocs-entry-title a'
166 + ]
167 + );
173 168
174 - $this->add_group_control(
175 - Group_Control_Text_Shadow::get_type(),
176 - [
177 - 'name' => 'text_shadow',
178 - 'selector' => '{{WRAPPER}} .betterdocs-entry-title'
179 - ]
180 - );
169 + $this->add_group_control(
170 + Group_Control_Text_Shadow::get_type(),
171 + [
172 + 'name' => 'text_shadow',
173 + 'selector' => '{{WRAPPER}} .betterdocs-entry-title'
174 + ]
175 + );
181 176
182 - $this->add_control(
183 - 'blend_mode',
184 - [
185 - 'label' => __( 'Blend Mode', 'betterdocs' ),
186 - 'type' => Controls_Manager::SELECT,
187 - 'options' => [
188 - '' => __( 'Normal', 'betterdocs' ),
189 - 'multiply' => 'Multiply',
190 - 'screen' => 'Screen',
191 - 'overlay' => 'Overlay',
192 - 'darken' => 'Darken',
193 - 'lighten' => 'Lighten',
194 - 'color-dodge' => 'Color Dodge',
195 - 'saturation' => 'Saturation',
196 - 'color' => 'Color',
197 - 'difference' => 'Difference',
198 - 'exclusion' => 'Exclusion',
199 - 'hue' => 'Hue',
200 - 'luminosity' => 'Luminosity'
201 - ],
202 - 'selectors' => [
203 - '{{WRAPPER}} .betterdocs-entry-title' => 'mix-blend-mode: {{VALUE}}'
204 - ],
205 - 'separator' => 'none'
206 - ]
207 - );
177 + $this->add_control(
178 + 'blend_mode',
179 + [
180 + 'label' => __( 'Blend Mode', 'betterdocs' ),
181 + 'type' => Controls_Manager::SELECT,
182 + 'options' => [
183 + '' => __( 'Normal', 'betterdocs' ),
184 + 'multiply' => 'Multiply',
185 + 'screen' => 'Screen',
186 + 'overlay' => 'Overlay',
187 + 'darken' => 'Darken',
188 + 'lighten' => 'Lighten',
189 + 'color-dodge' => 'Color Dodge',
190 + 'saturation' => 'Saturation',
191 + 'color' => 'Color',
192 + 'difference' => 'Difference',
193 + 'exclusion' => 'Exclusion',
194 + 'hue' => 'Hue',
195 + 'luminosity' => 'Luminosity'
196 + ],
197 + 'selectors' => [
198 + '{{WRAPPER}} .betterdocs-entry-title' => 'mix-blend-mode: {{VALUE}}'
199 + ],
200 + 'separator' => 'none'
201 + ]
202 + );
208 203
209 - $this->add_responsive_control(
210 - 'title_padding',
211 - [
212 - 'label' => esc_html__( 'Title Padding', 'betterdocs' ),
213 - 'type' => Controls_Manager::DIMENSIONS,
214 - 'size_units' => ['px', 'em', '%'],
215 - 'default' => [
216 - "top" => '0',
217 - "right" => '0',
218 - "bottom" => '0',
219 - "left" => '0',
220 - "isLinked" => false
221 - ],
222 - 'selectors' => [
223 - '{{WRAPPER}} .betterdocs-entry-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
224 - ]
225 - ]
226 - );
204 + $this->add_responsive_control(
205 + 'title_padding',
206 + [
207 + 'label' => esc_html__( 'Title Padding', 'betterdocs' ),
208 + 'type' => Controls_Manager::DIMENSIONS,
209 + 'size_units' => [ 'px', 'em', '%' ],
210 + 'default' => [
211 + 'top' => '0',
212 + 'right' => '0',
213 + 'bottom' => '0',
214 + 'left' => '0',
215 + 'isLinked' => false
216 + ],
217 + 'selectors' => [
218 + '{{WRAPPER}} .betterdocs-entry-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
219 + ]
220 + ]
221 + );
227 222
228 - $this->add_responsive_control(
229 - 'title_margin',
230 - [
231 - 'label' => esc_html__( 'Title Margin', 'betterdocs' ),
232 - 'type' => Controls_Manager::DIMENSIONS,
233 - 'size_units' => ['px', 'em', '%'],
234 - 'default' => [
235 - "top" => '0',
236 - "right" => '0',
237 - "bottom" => '0',
238 - "left" => '0',
239 - "isLinked" => false
240 - ],
241 - 'selectors' => [
242 - '{{WRAPPER}} .betterdocs-entry-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
243 - ]
244 - ]
245 - );
223 + $this->add_responsive_control(
224 + 'title_margin',
225 + [
226 + 'label' => esc_html__( 'Title Margin', 'betterdocs' ),
227 + 'type' => Controls_Manager::DIMENSIONS,
228 + 'size_units' => [ 'px', 'em', '%' ],
229 + 'default' => [
230 + 'top' => '0',
231 + 'right' => '0',
232 + 'bottom' => '0',
233 + 'left' => '0',
234 + 'isLinked' => false
235 + ],
236 + 'selectors' => [
237 + '{{WRAPPER}} .betterdocs-entry-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
238 + ]
239 + ]
240 + );
246 241
247 - $this->end_controls_section();
242 + $this->end_controls_section();
248 243
249 - $this->update_control(
250 - 'title',
251 - [
252 - 'dynamic' => [
253 - 'default' => Plugin::elementor()->dynamic_tags->tag_data_to_tag_text( null, 'betterdocs-title-tag' )
254 - ]
255 - ],
256 - [
257 - 'recursive' => true
258 - ]
259 - );
244 + $this->update_control(
245 + 'title',
246 + [
247 + 'dynamic' => [
248 + 'default' => Plugin::elementor()->dynamic_tags->tag_data_to_tag_text( null, 'betterdocs-title-tag' )
249 + ]
250 + ],
251 + [
252 + 'recursive' => true
253 + ]
254 + );
260 255
261 - $this->update_control(
262 - 'header_size',
263 - [
264 - 'default' => 'h1'
265 - ]
266 - );
267 - }
256 + $this->update_control(
257 + 'header_size',
258 + [
259 + 'default' => 'h1'
260 + ]
261 + );
262 + }
268 263
269 - public function render_callback() {
270 - $this->views( 'widgets/title' );
271 - }
264 + public function render_callback() {
265 + $this->views( 'widgets/title' );
266 + }
272 267
273 - public function view_params() {
274 - $this->add_inline_editing_attributes( 'title' );
275 - $title = $this->attributes['title'];
268 + public function view_params() {
269 + $this->add_inline_editing_attributes( 'title' );
270 + $title = $this->attributes['title'];
276 271
277 - if ( ! empty( $this->attributes['link']['url'] ) ) {
278 - $this->add_link_attributes( 'url', $this->attributes['link'] );
279 - $title = sprintf( '<a %1$s>%2$s</a>', $this->get_render_attribute_string( 'url' ), $title );
280 - }
272 + if ( ! empty( $this->attributes['link']['url'] ) ) {
273 + $this->add_link_attributes( 'url', $this->attributes['link'] );
274 + $title = sprintf( '<a %1$s>%2$s</a>', $this->get_render_attribute_string( 'url' ), $title );
275 + }
281 276
282 - return [
283 - 'tag' => $this->attributes['header_size'],
284 - 'title' => $title,
285 - 'wrapper_attr' => $this->get_render_attributes( 'title' )
286 - ];
287 - }
277 + return [
278 + 'tag' => $this->attributes['header_size'],
279 + 'title' => $title,
280 + 'wrapper_attr' => $this->get_render_attributes( 'title' )
281 + ];
282 + }
288 283
289 - public function render_plain_content() {}
284 + public function render_plain_content() {}
290 285 }