PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.4.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.4.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 3.5.2 All 199 releases
betterdocs / includes / Editors / Elementor / Widget / Content.php

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

151 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly
6 }
7
8 use Elementor\Core\Schemes;
9 use Elementor\Controls_Manager;
10 use Elementor\Group_Control_Typography;
11 use WPDeveloper\BetterDocs\Editors\Elementor\ContentBaseWidget;
12
13 class Content extends ContentBaseWidget {
14 public function get_name() {
15 return 'betterdocs-content';
16 }
17
18 public function get_title() {
19 return __( 'Doc Content', 'betterdocs' );
20 }
21
22 public function get_icon() {
23 return 'betterdocs-icon-Content';
24 }
25
26 public function get_categories() {
27 return ['betterdocs-elements-single'];
28 }
29
30 public function get_keywords() {
31 return ['betterdocs-elements', 'content', 'description', 'docs', 'betterdocs'];
32 }
33
34 public function get_custom_help_url() {
35 return 'https://betterdocs.co/docs/single-doc-in-elementor';
36 }
37
38 protected function register_controls() {
39 $this->start_controls_section(
40 'section_style',
41 [
42 'label' => __( 'Style', 'betterdocs' ),
43 'tab' => Controls_Manager::TAB_STYLE
44 ]
45 );
46
47 $this->add_control(
48 'print_btn',
49 [
50 'label' => __( 'Print Button', 'betterdocs' ),
51 'type' => Controls_Manager::SWITCHER,
52 'label_on' => __( 'Show', 'betterdocs' ),
53 'label_off' => __( 'Hide', 'betterdocs' ),
54 'return_value' => '1',
55 'default' => '1'
56 ]
57 );
58
59 $this->add_responsive_control(
60 'align',
61 [
62 'label' => __( 'Alignment', 'betterdocs' ),
63 'type' => Controls_Manager::CHOOSE,
64 'options' => [
65 'left' => [
66 'title' => __( 'Left', 'betterdocs' ),
67 'icon' => 'eicon-text-align-left'
68 ],
69 'center' => [
70 'title' => __( 'Center', 'betterdocs' ),
71 'icon' => 'eicon-text-align-center'
72 ],
73 'right' => [
74 'title' => __( 'Right', 'betterdocs' ),
75 'icon' => 'eicon-text-align-right'
76 ],
77 'justify' => [
78 'title' => __( 'Justified', 'betterdocs' ),
79 'icon' => 'eicon-text-align-justify'
80 ]
81 ],
82 'selectors' => [
83 '{{WRAPPER}}' => 'text-align: {{VALUE}};'
84 ]
85 ]
86 );
87
88 $this->add_group_control(
89 Group_Control_Typography::get_type(),
90 [
91 'name' => 'betterdocs_content_typography',
92 'selector' => '{{WRAPPER}} .betterdocs-content'
93 ]
94 );
95
96 $this->add_control(
97 'doc_content_color',
98 [
99 'label' => __( 'Doc Content Color', 'betterdocs' ),
100 'type' => Controls_Manager::COLOR,
101 'selectors' => [
102 '{{WRAPPER}} .betterdocs-content' => 'color: {{VALUE}}'
103 ]
104 ]
105 );
106
107 $this->add_control(
108 'doc_content_title_color',
109 [
110 'label' => __( 'Content Title Color', 'plugin-domain' ),
111 'type' => Controls_Manager::COLOR,
112 'selectors' => [
113 '{{WRAPPER}} .betterdocs-content .betterdocs-content-heading' => 'color: {{VALUE}}'
114 ]
115 ]
116 );
117
118 $this->add_group_control(
119 Group_Control_Typography::get_type(),
120 [
121 'name' => 'betterdocs_content_title_typography',
122 'selector' => '{{WRAPPER}} .betterdocs-content .betterdocs-content-heading'
123 ]
124 );
125 $this->end_controls_section();
126 }
127
128 protected function render_callback() {
129 $this->views( 'widgets/content' );
130 }
131
132 public function view_params() {
133 $toc_setting = get_transient( 'betterdocs_toc_setting' );
134 $htags = ( $toc_setting ) ? implode( ',', $toc_setting['htags'] ) : '';
135 $enable_toc = ( $htags ) ? 1 : '';
136
137 return [
138 'enable' => (bool) $this->attributes['print_btn'],
139 'htags' => $htags,
140 'enable_toc' => $enable_toc,
141 'wrapper_attr' => [
142 'class' => ['betterdocs-entry-content']
143 ]
144 ];
145 }
146
147 public function show_in_panel() {
148 return true;
149 }
150 }
151