PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.8.9
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.8.9
4.9.4 4.9.3 4.9.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 All 202 releases
← All changes | includes/Editors/BlockEditor/Blocks/SearchForm.php +70 -35 3.4.2 → 3.8.9 View file →
@@ -4,48 +4,83 @@
4 4
5 5 use WPDeveloper\BetterDocs\Editors\BlockEditor\Block;
6 6
7 7 class SearchForm extends Block {
8 - public $view_wrapper = 'betterdocs-search-form-wrapper';
8 + public $view_wrapper = 'betterdocs-search-form-wrapper';
9 9
10 - protected $editor_styles = [
11 - 'betterdocs-search'
12 - ];
10 + protected $editor_styles = [
11 + 'betterdocs-search',
12 + 'betterdocs-search-modal'
13 + ];
13 14
14 - protected $frontend_styles = [
15 - 'betterdocs-search'
16 - ];
17 - protected $frontend_scripts = [
18 - 'betterdocs-search'
19 - ];
15 + protected $frontend_styles = [
16 + 'betterdocs-search',
17 + 'betterdocs-search-modal'
18 + ];
19 + protected $frontend_scripts = [
20 + 'betterdocs-search',
21 + 'betterdocs-search-modal'
22 + ];
20 23
21 - /**
22 - * unique name of block
23 - * @return string
24 - */
25 - public function get_name() {
26 - return 'searchbox';
27 - }
24 + /**
25 + * unique name of block
26 + * @return string
27 + */
28 + public function get_name() {
29 + return 'searchbox';
30 + }
28 31
29 - public function get_default_attributes() {
30 - return [
31 - 'blockId' => '',
32 - 'placeholderText' => __( 'Search', 'betterdocs' )
33 - ];
34 - }
32 + public function get_default_attributes() {
33 + return [
34 + 'blockId' => '',
35 + 'placeholderText' => __( 'Search', 'betterdocs' ),
36 + 'searchLayout' => 'layout-1',
37 + 'searchHeading' => '',
38 + 'searchSubHeading' => '',
39 + 'searchButtonLayout2' => false, //for search modal
40 + 'categorySearchLayout2' => false, //for search modal
41 + 'popularSearchLayout2' => false, //for search modal,
42 + 'initialFAQNumber' => 5, //for search modal,
43 + 'initialDocsNumber' => 5, //for search modal,
44 + 'searchModalQueryTermIds' => '', //for search modal
45 + 'searchModalQueryDocIds' => '', //for search modal
46 + 'searchModalQueriesFaqGroupIds' => ''
47 + ];
48 + }
35 49
36 - public function render( $attributes, $content ) {
37 - $this->views( 'widgets/search-form' );
38 - }
50 + public function render( $attributes, $content ) {
51 + $settings = $this->attributes;
52 + if ( isset( $settings['searchLayout'] ) && $settings['searchLayout'] == 'layout-1' ) {
53 + $this->views( 'widgets/search-form' );
54 + } else {
55 + $popular_search = isset( $settings['popularSearchLayout2'] ) ? $settings['popularSearchLayout2'] : false;
56 + $category_search = isset( $settings['categorySearchLayout2'] ) ? $settings['categorySearchLayout2'] : false;
57 + $search_button = isset( $settings['searchButtonLayout2'] ) ? $settings['searchButtonLayout2'] : false;
58 + $number_of_docs = isset( $settings['initialDocsNumber'] ) ? $settings['initialDocsNumber'] : 5;
59 + $number_of_faqs = isset( $settings['initialFAQNumber'] ) ? $settings['initialFAQNumber'] : 5;
60 + $doc_categories_ids = isset( $settings['searchModalQueryTermIds'] ) ? $settings['searchModalQueryTermIds'] : '';
61 + $doc_ids = isset( $settings['searchModalQueryDocIds'] ) ? $settings['searchModalQueryDocIds'] : '';
62 + $faq_categories_ids = isset( $settings['searchModalQueriesFaqGroupIds'] ) ? $settings['searchModalQueriesFaqGroupIds'] : '';
63 + $searchHeading = isset( $settings['searchHeading'] ) ? $settings['searchHeading'] : '';
64 + $subHeading = isset( $settings['searchSubHeading'] ) ? $settings['searchSubHeading'] : '';
65 + echo '<div class="' . esc_attr( $settings['blockId'] ) . '">';
66 + echo do_shortcode( '[betterdocs_search_modal faq_categories_ids="' . $faq_categories_ids . '" doc_ids="' . $doc_ids . '" doc_categories_ids="' . $doc_categories_ids . '" number_of_docs="' . $number_of_docs . '" number_of_faqs="' . $number_of_faqs . '" search_button_text="Search" search_button="' . $search_button . '" popular_search="' . $popular_search . '" category_search="' . $category_search . '" layout="layout-1" heading="' . $searchHeading . '" subheading="' . $subHeading . '" heading_tag="h2" subheading_tag="h2" placeholder="' . $settings['placeholderText'] . '"]' );
67 + echo '</div>';
68 + }
69 + }
39 70
40 - public function view_params() {
41 - $settings = &$this->attributes;
71 + public function view_params() {
72 + $settings = &$this->attributes;
42 73
43 - $_shortcode_attributes = apply_filters( 'betterdocs_elementor_search_form_params', [
44 - 'placeholder' => esc_html( $settings['placeholderText'] )
45 - ], $this->attributes );
74 + $_shortcode_attributes = apply_filters(
75 + 'betterdocs_elementor_search_form_params',
76 + [
77 + 'placeholder' => esc_html( $settings['placeholderText'] )
78 + ],
79 + $this->attributes
80 + );
46 81
47 - return [
48 - 'shortcode_attr' => $_shortcode_attributes
49 - ];
50 - }
82 + return [
83 + 'shortcode_attr' => $_shortcode_attributes
84 + ];
85 + }
51 86 }