From 271664f50015d1e27fe6dac37b108c1b45f349e4 Mon Sep 17 00:00:00 2001 From: AntonLV Date: Tue, 3 Sep 2024 07:42:15 +0300 Subject: [PATCH] Ticket #4786 - Artificer: Add setting to hide search bar. --- .../template/system/scripts/BxTemplFunctions.php | 9 +++++---- modules/boonex/artificer/install/langs/en.xml | 1 + modules/boonex/artificer/install/sql/install.sql | 11 +++++++---- .../boonex/russian/data/langs/bx_artificer/ru.xml | 1 + template/_page_toolbar.html | 13 +------------ template/_page_toolbar_search.html | 12 ++++++++++++ template/scripts/BxBaseFunctions.php | 9 +++++++++ 7 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 template/_page_toolbar_search.html diff --git a/modules/boonex/artificer/data/template/system/scripts/BxTemplFunctions.php b/modules/boonex/artificer/data/template/system/scripts/BxTemplFunctions.php index 9595570041..fdc3b1374d 100644 --- a/modules/boonex/artificer/data/template/system/scripts/BxTemplFunctions.php +++ b/modules/boonex/artificer/data/template/system/scripts/BxTemplFunctions.php @@ -201,10 +201,11 @@ public function TemplPageAddComponent($sKey) $mixedResult = parent::TemplPageAddComponent($sKey); break; - case 'sys_site_search': - $oSearch = new BxTemplSearch(); - $oSearch->setLiveSearch(true); - $mixedResult = $oSearch->getForm(BX_DB_PADDING_DEF, false, true) . $oSearch->getResultsContainer(); + case 'sys_toolbar_search': + if(getParam('bx_artificer_header_search') == 'on') + $mixedResult = parent::TemplPageAddComponent($sKey); + else + $mixedResult = ''; break; default: diff --git a/modules/boonex/artificer/install/langs/en.xml b/modules/boonex/artificer/install/langs/en.xml index c2c6874c96..eb4019fd63 100644 --- a/modules/boonex/artificer/install/langs/en.xml +++ b/modules/boonex/artificer/install/langs/en.xml @@ -9,6 +9,7 @@ + diff --git a/modules/boonex/artificer/install/sql/install.sql b/modules/boonex/artificer/install/sql/install.sql index 67420afb13..aa0c25a0c3 100644 --- a/modules/boonex/artificer/install/sql/install.sql +++ b/modules/boonex/artificer/install/sql/install.sql @@ -13,10 +13,13 @@ SET @iCategoryId = LAST_INSERT_ID(); INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES (@iCategoryId, CONCAT(@sName, '_switcher_title'), '_bx_artificer_stg_cpt_option_switcher_name', 'Artificer', 'digit', '', '', '', 1), -(@iCategoryId, CONCAT(@sName, '_page_width'), '_bx_artificer_stg_cpt_option_page_width', '1280', 'digit', '', '', '', 2), -(@iCategoryId, CONCAT(@sName, '_header_stretched'), '_bx_artificer_stg_cpt_option_header_stretched', '', 'checkbox', '', '', '', 3), -(@iCategoryId, CONCAT(@sName, '_color_scheme'), '_bx_artificer_stg_cpt_option_color_scheme', 'auto', 'select', 'a:2:{s:6:"module";s:12:"bx_artificer";s:6:"method";s:24:"get_options_color_scheme";}', '', '', 4), -(@iCategoryId, CONCAT(@sName, '_use_htmx'), '_bx_artificer_stg_cpt_option_use_htmx', '', 'checkbox', '', '', '', 5); +(@iCategoryId, CONCAT(@sName, '_color_scheme'), '_bx_artificer_stg_cpt_option_color_scheme', 'auto', 'select', 'a:2:{s:6:"module";s:12:"bx_artificer";s:6:"method";s:24:"get_options_color_scheme";}', '', '', 2), + +(@iCategoryId, CONCAT(@sName, '_page_width'), '_bx_artificer_stg_cpt_option_page_width', '1280', 'digit', '', '', '', 10), +(@iCategoryId, CONCAT(@sName, '_header_stretched'), '_bx_artificer_stg_cpt_option_header_stretched', '', 'checkbox', '', '', '', 11), +(@iCategoryId, CONCAT(@sName, '_header_search'), '_bx_artificer_stg_cpt_option_header_search', 'on', 'checkbox', '', '', '', 12), + +(@iCategoryId, CONCAT(@sName, '_use_htmx'), '_bx_artificer_stg_cpt_option_use_htmx', '', 'checkbox', '', '', '', 30); -- SETTINGS: Artificer template Custom Styles INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES diff --git a/modules/boonex/russian/data/langs/bx_artificer/ru.xml b/modules/boonex/russian/data/langs/bx_artificer/ru.xml index bc85bd77c3..c230110f28 100644 --- a/modules/boonex/russian/data/langs/bx_artificer/ru.xml +++ b/modules/boonex/russian/data/langs/bx_artificer/ru.xml @@ -9,6 +9,7 @@ + diff --git a/template/_page_toolbar.html b/template/_page_toolbar.html index b43a0d0f1e..2d1469390f 100644 --- a/template/_page_toolbar.html +++ b/template/_page_toolbar.html @@ -23,18 +23,7 @@ diff --git a/template/_page_toolbar_search.html b/template/_page_toolbar_search.html new file mode 100644 index 0000000000..2af06f834a --- /dev/null +++ b/template/_page_toolbar_search.html @@ -0,0 +1,12 @@ + +
+ + +
+ +
+
+
+
diff --git a/template/scripts/BxBaseFunctions.php b/template/scripts/BxBaseFunctions.php index d9ef02de60..49f0640f15 100644 --- a/template/scripts/BxBaseFunctions.php +++ b/template/scripts/BxBaseFunctions.php @@ -66,6 +66,15 @@ function TemplPageAddComponent($sKey) case 'sys_header_width': $mixedResult = 'bx-def-page-width'; break; + + case 'sys_toolbar_search': + $oSearch = new BxTemplSearch(); + $oSearch->setLiveSearch(true); + + $mixedResult = $this->_oTemplate->parseHtmlByName('_page_toolbar_search.html', [ + 'sys_site_search' => $oSearch->getForm(BX_DB_PADDING_DEF, false, true) . $oSearch->getResultsContainer() + ]); + break; } return $mixedResult;