PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.5.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.5.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 / DocsArchive.php

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

116 lines 2.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;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly
6 }
7
8 use ElementorPro\Modules\ThemeBuilder\Documents\Archive;
9
10 class DocsArchive extends Archive {
11 public static function get_properties() {
12 $properties = parent::get_properties();
13
14 $properties['location'] = 'archive';
15 $properties['condition_type'] = 'doc_archive';
16
17 return $properties;
18 }
19
20 public static function get_type() {
21 return 'doc-archive';
22 }
23
24 public static function get_title() {
25 return __( 'Docs Archive', 'betterdocs' );
26 }
27
28 public static function get_plural_title() {
29 return __( 'Docs Archives', 'betterdocs' );
30 }
31
32 protected static function get_site_editor_icon() {
33 return 'eicon-products';
34 }
35
36 public static function get_preview_as_default() {
37 return 'post_type_archive/docs';
38 }
39
40 public static function get_preview_as_options() {
41 $post_type_archives = [];
42 $taxonomies = [];
43 $post_type = 'docs';
44
45 $post_type_object = get_post_type_object( $post_type );
46
47 if ( $post_type_object ) {
48 $post_type_archives[ 'post_type_archive/' . $post_type ] = $post_type_object->label . ' ' . __( 'Archive', 'betterdocs' );
49 }
50
51 $post_type_taxonomies = get_object_taxonomies( $post_type, 'objects' );
52
53 $post_type_taxonomies = wp_filter_object_list(
54 $post_type_taxonomies,
55 [
56 'public' => true,
57 'show_in_nav_menus' => true
58 ]
59 );
60
61 foreach ( $post_type_taxonomies as $slug => $object ) {
62 $taxonomies[ 'taxonomy/' . $slug ] = $object->label . ' ' . __( 'Archive', 'betterdocs' );
63 }
64
65 $options = [
66 'search' => __( 'Search Results', 'betterdocs' )
67 ];
68
69 $options += $taxonomies + $post_type_archives;
70
71 return [
72 'archive' => [
73 'label' => __( 'Archive', 'betterdocs' ),
74 'options' => $options
75 ]
76 ];
77 }
78
79 protected static function get_editor_panel_categories() {
80 $categories = [
81 'docs-archive' => [
82 'title' => __( 'Docs Archive', 'betterdocs' )
83 ]
84 ];
85 $categories += parent::get_editor_panel_categories();
86 unset( $categories['theme-elements-archive'] );
87 return $categories;
88 }
89
90 public static function get_editor_panel_config() {
91 $config = parent::get_editor_panel_config();
92
93 $config['widgets_settings']['theme-archive-title']['categories'][] = 'docs-archive';
94 return $config;
95 }
96
97 protected function register_controls() {
98 parent::register_controls();
99
100 $this->update_control(
101 'preview_type',
102 [
103 'default' => 'post_type_archive/docs'
104 ]
105 );
106 }
107
108 protected function get_remote_library_config() {
109 $config = parent::get_remote_library_config();
110
111 $config['category'] = 'Docs Archive';
112 $config['urls']['thumbnail'] = plugins_url( '/assets/admin/images/customizer/customizer-preview.png', __FILE__ );
113 return $config;
114 }
115 }
116