PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 2.0.14
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v2.0.14
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 / admin / partials / betterdocs-settings-form.php

betterdocs-settings-form.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 2.0.14, at admin/partials/betterdocs-settings-form.php

97 lines 5.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <div class="betterdocs-settings-form-wrapper">
2 <form method="post" id="betterdocs-settings-form" action="#">
3 <?php
4 $i = 1;
5 /**
6 * Settings Tab Content Rendering
7 */
8 foreach( $settings_args as $tab_key => $setting ) {
9 $active = $i++ === 1 ? 'active ' : '';
10 $sections = isset( $setting['sections'] ) ? $setting['sections'] : [];
11 $sections = BetterDocs_Helper::sorter( $sections, 'priority', 'ASC' );
12 $is_form = isset( $setting['form'] ) ? $setting['form'] : false;
13 ?>
14 <div
15 id="betterdocs-<?php echo esc_attr( $tab_key ); ?>"
16 class="betterdocs-settings-tab betterdocs-settings-<?php echo esc_attr( $key );?> <?php echo $active; ?>">
17 <?php
18 if( isset( $setting['views'] ) && ! empty( $setting['views'] ) ) {
19 call_user_func_array( $setting['views'], isset( $setting['sections'] ) ? array( 'sections' => $setting['sections'] ) : [] );
20 }
21 if( ! empty( $sections ) && ! isset( $setting['views'] ) ) :
22 /**
23 * Every Section of a tab
24 * Rendering.
25 */
26 foreach( $sections as $sec_key => $section ) :
27 $fields = isset( $section['fields'] ) ? $section['fields'] : [];
28 $fields = BetterDocs_Helper::sorter( $fields, 'priority', 'ASC' );
29
30 $sectionTabs = isset( $section['tabs'] ) ? $section['tabs'] : [];
31 $sectionTabs = BetterDocs_Helper::sorter( $sectionTabs, 'priority', 'ASC' );
32
33 ?>
34 <div
35 id="betterdocs-settings-<?php echo esc_attr( $sec_key ); ?>"
36 class="betterdocs-settings-section betterdocs-<?php echo esc_attr( $sec_key ); ?>">
37 <?php
38
39 if( ! empty( $sectionTabs ) ) {
40 ?>
41 <div class="betterdocs-section-inner-tab">
42 <ul class="betterdocs-section-inner-tab-menu">
43 <?php
44 array_walk( $sectionTabs, function( $value, $key ){
45 echo '<li data-target="'. $key .'">' . $value['title'] . '</li>';
46 } );
47 ?>
48 </ul>
49 <div class="betterdocs-section-inner-tab-contents">
50 <?php
51 array_walk( $sectionTabs, function( $section, $key ){
52 $fields = isset( $section['fields'] ) ? $section['fields'] : [];
53 $fields = BetterDocs_Helper::sorter( $fields, 'priority', 'ASC' );
54 echo '<div class="betterdocs-section-inner-tab-content" id="'. $key .'"><table><tbody>';
55 array_walk( $fields, function( $field, $field_key ){
56 BetterDocs_Settings::render_field( $field_key, $field );
57 } );
58 echo '</tbody></table></div>';
59 } );
60 ?>
61 </div>
62 </div>
63 <?php
64 }
65
66 if( isset( $section['views'] ) && ! empty( $section['views'] ) ) {
67 call_user_func_array( $section['views'],
68 isset( $section['fields'] ) ? array( 'fields' => $section['fields'] ) : [] );
69 }
70 /**
71 * Every Section Field Rendering
72 */
73 if( ! empty( $fields ) && ! isset( $section['views'] ) ) : ?>
74 <table>
75 <tbody>
76 <?php
77 foreach( $fields as $field_key => $field ) :
78 BetterDocs_Settings::render_field( $field_key, $field );
79 endforeach;
80 ?>
81 </tbody>
82 </table>
83 <?php endif; // fields rendering end ?>
84 </div>
85 <?php
86 endforeach;
87 endif; // sections rendering end
88
89 // Submit Button
90 if( isset( $setting['button_text'] ) && ! empty( $setting['button_text'] ) ) :
91 ?>
92 <button type="submit" class="btn-settings betterdocs-settings-button betterdocs-submit-<?php echo $tab_key; ?>" data-nonce="<?php echo wp_create_nonce('betterdocs_'. $tab_key .'_nonce'); ?>" data-key="<?php echo $tab_key; ?>" id="betterdocs-submit-<?php echo $tab_key; ?>"><?php _e( $setting['button_text'], 'betterdocs' ); ?></button>
93 <?php endif; ?>
94 </div>
95 <?php } ?>
96 </form>
97 </div>