Comment to 'What happened to the search box in RC1?'
  • ### Proposed Solution

    **New Setting in Admin Panel:**

    Implement three options for the search box display:

    1. Show as an Icon

    2. Show as a Search Box

    3. Hide Completely

    **Implementation Steps:**

    1. **Modify Admin Panel Settings:**

      - Update the configuration to allow the new option for displaying the full search box.

    2. **Update the Following Files:**

      - **Update `modules/boonex/artificer/data/template/system/scripts/BxTemplFunctions.php`:**

       ```php

       public function TemplPageAddComponent($sKey)

       {

         // existing code...

         case 'sys_toolbar_search':

           $oSearch = new BxTemplSearch();

           $oSearch->setLiveSearch(true);

           

           $searchDisplayOption = getParam('bx_artificer_header_search');

           if ($searchDisplayOption == 'show_as_search_box') {

             $mixedResult = $this->_oTemplate->parseHtmlByName('_page_toolbar_full_search.html', [

               'sys_site_search' => $oSearch->getForm(BX_DB_PADDING_DEF, false, true) . $oSearch->getResultsContainer()

             ]);

           } elseif ($searchDisplayOption == 'show_as_icon') {

             $mixedResult = '<div class="bx-ti-search-button"><a href="javascript:void(0)" onclick="javascript:bx_site_search_show(this)"><div class="bx-icon"><bx_image_auto:search /></div></a></div>'; // Update with the actual icon HTML

           } else {

             $mixedResult = ''; // Hide search box

           }

           break;

         // existing code...

       }

       ```

      - **Update `modules/boonex/artificer/install/langs/en.xml`:**

       ```xml

       <string name="_bx_artificer_stg_cpt_option_header_search"><![CDATA[Search Box Display Option]]></string>

       <string name="_bx_artificer_stg_cpt_option_header_search_show_as_search_box"><![CDATA[Show as Search Box]]></string>

       <string name="_bx_artificer_stg_cpt_option_header_search_show_as_icon"><![CDATA[Show as Icon]]></string>

       <string name="_bx_artificer_stg_cpt_option_header_search_hide"><![CDATA[Hide Completely]]></string>

       ```

      - **Update `modules/boonex/artificer/install/sql/install.sql`:**

       ```sql

       INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES

       (@iCategoryId, CONCAT(@sName, '_header_search'), '_bx_artificer_stg_cpt_option_header_search', 'show_as_search_box', 'select', 'a:3:{s:6:"show_as_search_box";s:17:"Show as Search Box";s:12:"show_as_icon";s:11:"Show as Icon";s:4:"hide";s:12:"Hide Completely";}', '', '', 12);

       ```

      - **Create a New File: `modules/boonex/artificer/data/template/system/_page_toolbar_full_search.html`:**

       ```html

       <div class="bx-ti-search-box flex-auto flex items-start md:min-w-88 mr-2 bg-white/95 dark:bg-gray-800/95 rounded-md shadow-md hidden">

         <div class="relative w-full">__sys_site_search__</div>

       </div>

       <div class="bx-ti-search-button group relative inline-flex items-center mx-2 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 text-base font-medium leading-6 border border-transparent hover:border-gray-200/50 active:border-gray-300 dark:hover:border-gray-700/50 dark:active:border-gray-700 bg-gray-100 dark:bg-gray-700/50 active:bg-gray-300 dark:active:bg-black/50 hover:bg-gray-200/50 dark:hover:bg-gray-700/50 rounded-full">

         <a href="javascript:void(0)" onclick="javascript:bx_site_search_show(this)">

           <span class="relative flex items-center justify-center h-10 w-10">

             <div class="bx-icon">

               <bx_image_auto:search />

             </div>

           </span>

         </a>

       </div>

       ```

      - **Update `modules/boonex/artificer/data/template/system/pt_application.html`:**

       Update the search section to include the new search box layout:

       ```html

       <div class="bx-toolbar-item bx-ti-search flex flex-1 items-center justify-end">

         <!-- Full Search Box -->

         __sys_toolbar_full_search__

         <!-- Existing Search Toolbar -->

         

       </div>

       ```

    ---

    I don't know very well how the platform works and I don't know if it would work correctly, but I think the idea is worth considering