PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 1.7.1
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v1.7.1
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 3.5.2 All 199 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 1.7.1, at includes/elementor/widgets/betterdocs-elementor-title.php

255 lines 7.7 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'];
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->end_controls_section();
208
209 $this->update_control(
210 'title',
211 [
212 'dynamic' => [
213 'default' => Plugin::elementor()->dynamic_tags->tag_data_to_tag_text( null, 'betterdocs-title-tag' ),
214 ],
215 ],
216 [
217 'recursive' => true,
218 ]
219 );
220
221 $this->update_control(
222 'header_size',
223 [
224 'default' => 'h1',
225 ]
226 );
227 }
228
229 protected function render() {
230 $this->add_render_attribute('title', 'id', ['betterdocs-entry-title']);
231 $this->add_render_attribute('title', 'class', ['product_title', 'entry-title']);
232 $settings = $this->get_settings_for_display();
233
234 $this->add_render_attribute('title', 'class', 'elementor-heading-title');
235
236 $this->add_inline_editing_attributes('title');
237
238 $title = $settings['title'];
239
240 if (!empty($settings['link']['url'])) {
241 $this->add_link_attributes('url', $settings['link']);
242
243 $title = sprintf('<a %1$s>%2$s</a>', $this->get_render_attribute_string('url'), $title);
244 }
245
246 $title_html = sprintf('<%1$s %2$s>%3$s</%1$s>', $settings['header_size'],
247 $this->get_render_attribute_string('title'), $title);
248
249 echo $title_html;
250 }
251
252 public function render_plain_content () {
253 }
254 }
255