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 / Navigation.php

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

261 lines 6.0 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\Controls_Manager;
9 use Elementor\Group_Control_Typography;
10 use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget;
11
12 class Navigation extends BaseWidget {
13
14 public function get_name() {
15 return 'betterdocs-navigation';
16 }
17
18 public function get_title() {
19 return __( 'Doc Navigation', 'betterdocs' );
20 }
21
22 public function get_icon() {
23 return 'betterdocs-icon-Navigation';
24 }
25
26 public function get_categories() {
27 return [ 'betterdocs-elements-single' ];
28 }
29
30 public function get_keywords() {
31 return [ 'betterdocs-elements', 'navigation', 'betterdocs', 'docs' ];
32 }
33
34 public function get_style_depends() {
35 return [ 'betterdocs-el-navigation' ];
36 }
37
38 public function get_custom_help_url() {
39 return 'https://betterdocs.co/docs/single-doc-in-elementor';
40 }
41
42 protected function register_controls() {
43 $this->layout_select();
44 $this->style_controls();
45 $this->style_controls_layout_2();
46 }
47
48 public function layout_select() {
49 $this->start_controls_section(
50 'navigation_section_title',
51 [
52 'label' => __( 'Controls', 'betterdocs' )
53 ]
54 );
55
56 $this->add_control(
57 'navigation_layout_select',
58 [
59 'label' => esc_html__( 'Select layout', 'betterdocs' ),
60 'type' => Controls_Manager::SELECT,
61 'default' => 'layout-1',
62 'label_block' => false,
63 'options' => [
64 'layout-1' => esc_html__( 'Layout 1', 'betterdocs' ),
65 'layout-2' => esc_html__( 'Layout 2', 'betterdocs' )
66 ]
67 ]
68 );
69
70 $this->end_controls_section();
71 }
72
73 public function style_controls() {
74 $this->start_controls_section(
75 'section_column_settings',
76 [
77 'label' => __( 'Style', 'betterdocs' ),
78 'tab' => Controls_Manager::TAB_STYLE,
79 'condition' => [
80 'navigation_layout_select' => [ 'layout-1' ]
81 ]
82 ]
83 );
84
85 $this->add_control(
86 'navigation_text_color',
87 [
88 'label' => esc_html__( 'Color', 'betterdocs' ),
89 'type' => Controls_Manager::COLOR,
90 'selectors' => [
91 '{{WRAPPER}} .docs-navigation a' => 'color: {{VALUE}};'
92 ]
93 ]
94 );
95
96 $this->add_group_control(
97 Group_Control_Typography::get_type(),
98 [
99 'name' => 'navigation_text_typography',
100 'selector' => '{{WRAPPER}} .docs-navigation a'
101 ]
102 );
103
104 $this->add_control(
105 'navigation_arrow_size',
106 [
107 'label' => __( 'Size', 'betterdocs' ),
108 'type' => Controls_Manager::SLIDER,
109 'default' => [
110 'unit' => 'px',
111 'size' => 35
112 ],
113 'size_units' => [ 'px' ],
114 'range' => [
115 'px' => [
116 'max' => 500,
117 'step' => 1
118 ]
119 ],
120 'selectors' => [
121 '{{WRAPPER}} .docs-navigation svg' => 'width: {{SIZE}}px;height: {{SIZE}}px;'
122 ]
123 ]
124 );
125
126 $this->add_control(
127 'navigation_arrow_color',
128 [
129 'label' => esc_html__( 'Arrow Color', 'betterdocs' ),
130 'type' => Controls_Manager::COLOR,
131 'selectors' => [
132 '{{WRAPPER}} .docs-navigation svg' => 'fill: {{VALUE}};'
133 ]
134 ]
135 );
136
137 $this->end_controls_section();
138 }
139
140 public function style_controls_layout_2() {
141 $this->start_controls_section(
142 'section_column_settings_layout_2',
143 [
144 'label' => __( 'Style', 'betterdocs' ),
145 'tab' => Controls_Manager::TAB_STYLE,
146 'condition' => [
147 'navigation_layout_select' => [ 'layout-2' ]
148 ]
149 ]
150 );
151
152 $this->add_control(
153 'navigation_text_background_color_layout_2',
154 [
155 'label' => esc_html__( 'Background Color', 'betterdocs' ),
156 'type' => Controls_Manager::COLOR,
157 'selectors' => [
158 '{{WRAPPER}} .docs-navigation.layout-2' => 'background-color: {{VALUE}};'
159 ]
160 ]
161 );
162
163 $this->add_control(
164 'navigation_text_color_layout_2',
165 [
166 'label' => esc_html__( 'Color', 'betterdocs' ),
167 'type' => Controls_Manager::COLOR,
168 'selectors' => [
169 '{{WRAPPER}} .docs-navigation.layout-2 a' => 'color: {{VALUE}};'
170 ]
171 ]
172 );
173
174 $this->add_group_control(
175 Group_Control_Typography::get_type(),
176 [
177 'name' => 'navigation_text_typography_layout_2',
178 'selector' => '{{WRAPPER}} .docs-navigation.layout-2 a'
179 ]
180 );
181
182 $this->add_control(
183 'navigation_arrow_size_layout_2',
184 [
185 'label' => __( 'Size', 'betterdocs' ),
186 'type' => Controls_Manager::SLIDER,
187 'default' => [
188 'unit' => 'px',
189 'size' => 35
190 ],
191 'size_units' => [ 'px' ],
192 'range' => [
193 'px' => [
194 'max' => 500,
195 'step' => 1
196 ]
197 ],
198 'selectors' => [
199 '{{WRAPPER}} .docs-navigation.layout-2 a svg' => 'width: {{SIZE}}px;height: {{SIZE}}px;'
200 ]
201 ]
202 );
203
204 $this->add_control(
205 'navigation_arrow_color_layout_2',
206 [
207 'label' => esc_html__( 'Arrow Color', 'betterdocs' ),
208 'type' => Controls_Manager::COLOR,
209 'selectors' => [
210 '{{WRAPPER}} .docs-navigation.layout-2 a svg' => 'fill: {{VALUE}};'
211 ]
212 ]
213 );
214
215 $this->add_responsive_control(
216 'navigation_margin_layout_2',
217 [
218 'label' => __( 'Margin', 'betterdocs' ),
219 'type' => Controls_Manager::DIMENSIONS,
220 'size_units' => [ 'px', 'em', '%' ],
221 'selectors' => [
222 '{{WRAPPER}} .docs-navigation.layout-2' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
223 ]
224 ]
225 );
226
227 $this->add_responsive_control(
228 'navigation_padding_layout_2',
229 [
230 'label' => __( 'Padding', 'betterdocs' ),
231 'type' => Controls_Manager::DIMENSIONS,
232 'size_units' => [ 'px', 'em', '%' ],
233 'selectors' => [
234 '{{WRAPPER}} .docs-navigation.layout-2' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
235 ]
236 ]
237 );
238
239 $this->end_controls_section();
240 }
241
242 protected function render_callback() {
243 $this->views( 'templates/parts/navigation' );
244 }
245
246 public function view_params() {
247 $layout = $this->attributes['navigation_layout_select'];
248 $default_params = [
249 'wrapper_attr' => [
250 'class' => [ 'betterdocs-elementor-navigation' ]
251 ]
252 ];
253
254 if ( $layout == 'layout-2' ) {
255 $default_params['wraper_class'] = 'layout-2';
256 }
257
258 return $default_params;
259 }
260 }
261