PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.2.0
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.2.0
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 / Editors / Elementor / Widget / ReadingTime.php

ReadingTime.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.2.0, at includes/Editors/Elementor/Widget/ReadingTime.php

246 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly
7 }
8
9 use Elementor\Controls_Manager;
10 use Elementor\Group_Control_Typography;
11 use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget;
12 use Elementor\Group_Control_Border;
13
14 class ReadingTime extends BaseWidget {
15
16 public function get_name() {
17 return 'betterdocs-reading-time';
18 }
19
20 public function get_style_depends() {
21 return [ 'reading-time' ];
22 }
23
24 public function get_title() {
25 return __( 'Reading Time', 'betterdocs' );
26 }
27
28 public function get_icon() {
29 return 'betterdocs-icon-Reading-Time';
30 }
31
32 public function get_categories() {
33 return [ 'betterdocs-elements', 'single-doc' ];
34 }
35
36 public function get_keywords() {
37 return [ 'betterdocs-elements', 'betterdocs', 'docs', 'single-doc' ];
38 }
39
40 public function get_custom_help_url() {
41 return 'https://betterdocs.co/docs/docs-archive-in-elementor/';
42 }
43
44 protected function register_controls() {
45 $this->start_controls_section(
46 'section_content',
47 [
48 'label' => __( 'Content', 'betterdocs' ),
49 'tab' => Controls_Manager::TAB_STYLE
50 ]
51 );
52
53 $this->add_control(
54 'ert_reading_title',
55 [
56 'label' => __( 'Reading Time Title', 'betterdocs' ),
57 'type' => Controls_Manager::TEXT,
58 'default' => '',
59 'placeholder' => __( 'Type Here', 'betterdocs' )
60 ]
61 );
62
63 $this->add_control(
64 'ert_reading_text',
65 [
66 'label' => __( 'Reading Time Text', 'betterdocs' ),
67 'type' => Controls_Manager::TEXT,
68 'default' => __( 'min read', 'betterdocs' ),
69 'placeholder' => __( 'Type Here', 'betterdocs' )
70 ]
71 );
72
73 $this->add_control(
74 'singular_ert_reading_text',
75 [
76 'label' => __( 'Singluar Reading Time Text', 'betterdocs' ),
77 'type' => Controls_Manager::TEXT,
78 'default' => __( 'min read', 'betterdocs' ),
79 'placeholder' => __( 'Type Here', 'betterdocs' )
80 ]
81 );
82
83 $this->end_controls_section();
84
85 $this->start_controls_section(
86 'section_reading_style',
87 [
88 'label' => __( 'Style', 'betterdocs' ),
89 'tab' => Controls_Manager::TAB_STYLE
90 ]
91 );
92
93 $this->add_responsive_control(
94 'reading_background_color',
95 [
96 'label' => esc_html__( 'Background Color', 'betterdocs' ),
97 'type' => Controls_Manager::COLOR,
98 'selectors' => [
99 '{{WRAPPER}} .reading-time' => 'background-color: {{VALUE}};'
100 ]
101 ]
102 );
103
104 $this->add_control(
105 'reading_text_color',
106 [
107 'label' => __( 'Text Color', 'betterdocs' ),
108 'type' => Controls_Manager::COLOR,
109 'selectors' => [
110 '{{WRAPPER}} .reading-time p' => 'color: {{VALUE}}'
111 ]
112 ]
113 );
114
115 $this->add_group_control(
116 Group_Control_Typography::get_type(),
117 [
118 'name' => 'reading_text_typo',
119 'selector' => '{{WRAPPER}} .reading-time p'
120 ]
121 );
122
123 $this->add_control(
124 'reading_box_width',
125 [
126 'label' => __( 'Width', 'betterdocs' ),
127 'type' => Controls_Manager::SLIDER,
128 'size_units' => [ 'px', '%' ],
129 'range' => [
130 'px' => [
131 'max' => 500,
132 'step' => 1
133 ],
134 '%' => [
135 'max' => 100,
136 'step' => 1
137 ]
138 ],
139 'selectors' => [
140 '{{WRAPPER}} .reading-time' => 'width: {{SIZE}}px;'
141 ]
142 ]
143 );
144
145 $this->add_group_control(
146 Group_Control_Border::get_type(),
147 [
148 'name' => 'reading_box_border',
149 'label' => esc_html__( 'Border', 'betterdocs' ),
150 'selector' => '{{WRAPPER}} .reading-time'
151 ]
152 );
153
154 $this->add_control(
155 'reading_box_border_radius',
156 [
157 'label' => __( 'Border Radius', 'betterdocs' ),
158 'type' => Controls_Manager::SLIDER,
159 'size_units' => [ 'px', '%' ],
160 'range' => [
161 'px' => [
162 'max' => 500,
163 'step' => 1
164 ],
165 '%' => [
166 'max' => 100,
167 'step' => 1
168 ]
169 ],
170 'selectors' => [
171 '{{WRAPPER}} .reading-time' => 'border-radius: {{SIZE}}px;'
172 ]
173 ]
174 );
175
176 $this->add_responsive_control(
177 'reading_padding',
178 [
179 'label' => __( 'Padding', 'betterdocs' ),
180 'type' => Controls_Manager::DIMENSIONS,
181 'size_units' => [ 'px', 'em', '%' ],
182 'selectors' => [
183 '{{WRAPPER}} .reading-time' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
184 ]
185 ]
186 );
187
188 $this->add_responsive_control(
189 'reading_margin',
190 [
191 'label' => __( 'Margin', 'betterdocs' ),
192 'type' => Controls_Manager::DIMENSIONS,
193 'size_units' => [ 'px', 'em', '%' ],
194 'selectors' => [
195 '{{WRAPPER}} .reading-time' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
196 ]
197 ]
198 );
199
200 $this->add_control(
201 'clock_icon_width',
202 [
203 'label' => __( 'Clock Icon Width', 'betterdocs' ),
204 'type' => Controls_Manager::SLIDER,
205 'size_units' => [ 'px', '%' ],
206 'range' => [
207 'px' => [
208 'max' => 500,
209 'step' => 1
210 ],
211 '%' => [
212 'max' => 100,
213 'step' => 1
214 ]
215 ],
216 'selectors' => [
217 '{{WRAPPER}} .reading-time p svg' => 'width: {{SIZE}}px;'
218 ]
219 ]
220 );
221
222 $this->add_responsive_control(
223 'clock_icon_color',
224 [
225 'label' => esc_html__( 'Clock Icon Color', 'betterdocs' ),
226 'type' => Controls_Manager::COLOR,
227 'selectors' => [
228 '{{WRAPPER}} .reading-time p svg path' => 'fill: {{VALUE}};'
229 ]
230 ]
231 );
232
233 $this->end_controls_section();
234 }
235
236 public function view_params() {
237 return [
238 'attributes' => $this->attributes
239 ];
240 }
241
242 protected function render_callback() {
243 $this->views( 'widgets/reading-time' );
244 }
245 }
246