PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 2.0.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v2.0.5
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 3.5.1 All 200 releases
betterdocs / includes / elementor / widgets / betterdocs-elementor-title.php

betterdocs-elementor-title.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 2.0.5, at includes/elementor/widgets/betterdocs-elementor-title.php

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