PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.9.1
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.9.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 / Shortcodes / CategoryBoxThree.php

CategoryBoxThree.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 3.9.1, at includes/Shortcodes/CategoryBoxThree.php

113 lines 2.9 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\Shortcodes;
4
5 use WPDeveloper\BetterDocs\Shortcodes\CategoryBox;
6
7 class CategoryBoxThree extends CategoryBox {
8 protected $layout_class = 'layout-4';
9
10 /**
11 * Summary of get_id
12 * @return string
13 */
14 public function get_name() {
15 return 'betterdocs_category_box_3';
16 }
17
18 /**
19 * Summary of default_attributes
20 * @return array
21 */
22 public function default_attributes() {
23 return [
24 'taxonomy' => 'doc_category',
25 'column' => $this->settings->get( 'column_number', 4 ),
26 'nested_subcategory' => $this->settings->get( 'nested_subcategory', false ),
27 'terms' => '',
28 'terms_order' => $this->settings->get( 'terms_order', 'ASC' ),
29 'terms_orderby' => $this->settings->get( 'terms_orderby', 'betterdocs_order' ),
30 'kb_slug' => '',
31 'multiple_knowledge_base' => false,
32 'disable_customizer_style' => false,
33 'title_tag' => 'h2',
34 'show_description' => false,
35 'show_icon' => true,
36 'category_icon' => 'folder',
37 'last_update' => '',
38 ];
39 }
40
41 public function header_sequence( $_layout_sequence, $layout, $widget_type, $_defined_vars ) {
42 $_new_layout_sequence = [
43 'category_icon',
44 [
45 'class' => 'betterdocs-category-title-counts',
46 'sequence' => [ 'category_title', 'category_description', 'sub_category_counts', 'last_update' ]
47 ]
48 ];
49
50 return $_new_layout_sequence;
51 }
52
53 /**
54 * Summary of render
55 *
56 * @param mixed $atts
57 * @param mixed $content
58 * @return mixed
59 */
60 public function render( $atts, $content = null ) {
61 parent::render( $atts, $content );
62 }
63
64 public function view_params() {
65 $parent_params = parent::view_params();
66 $query_arg = $parent_params['terms_query_args'];
67
68 $term_count = count( get_terms( $query_arg ) );
69 $styles = '';
70
71 if ( $this->isset( 'column' ) ) {
72 $_c = intval( $this->attributes['column'] );
73 } else {
74 $_c = 4;
75 }
76
77 if ( is_tax( 'doc_category' ) && ! $this->isset( 'column' ) ) {
78 $_c = 3;
79 }
80
81 $styles .= "--column: $_c;";
82 $styles .= "--count: $term_count;";
83 $reminder = $term_count % $_c;
84 $styles .= "--reminder: $reminder;";
85
86 $classes = [ 'betterdocs-categories-folder', $this->layout_class ];
87
88 if ( $this->isset( 'border_bottom', true ) ) {
89 $classes[] = 'border-bottom';
90 }
91
92 if ( $this->isset( 'disable_customizer_style', false ) ) {
93 $classes[] = 'single-kb';
94 }
95
96 $inner_wrapper_attr = [
97 'class' => $classes,
98 'style' => $styles,
99 ];
100
101 $_view_params = [
102 'layout' => 'layout-4',
103 'reminder' => $reminder,
104 'column' => $_c,
105 'total_terms' => $term_count,
106 'inner_wrapper_attr' => $inner_wrapper_attr,
107 'show_icon' => $this->attributes['show_icon']
108 ];
109
110 return $this->merge( $parent_params, $_view_params );
111 }
112 }
113