From 7beae22f44f50501bd888f180c425dc75915c8af Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 24 Jun 2021 16:49:22 -0700 Subject: [PATCH] Removed search shortcode parameter limitations. --- .../shortcodes/batch/search_shortcodes.php | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/e107_core/shortcodes/batch/search_shortcodes.php b/e107_core/shortcodes/batch/search_shortcodes.php index ab55de5ed..56cb3372c 100644 --- a/e107_core/shortcodes/batch/search_shortcodes.php +++ b/e107_core/shortcodes/batch/search_shortcodes.php @@ -9,21 +9,38 @@ if(!defined('e107_INIT')) class search_shortcodes extends e_shortcode { - function sc_search_input($parm=null) + function sc_search_input($parm=array()) { - $size = !empty($parm['size']) ? $parm['size'] : 20; - $class = isset($parm['class']) ? $parm['class'] : 'tbox search'; + if(empty($parm['size'])) + { + $parm['size'] = 20; + } - return e107::getForm()->text('q','', 50, ['size'=>$size, 'class'=>$class]); - // return ""; + if(!isset($parm['class'])) + { + $parm['class'] = 'tbox search'; + } + + return e107::getForm()->text('q','', 50, $parm); } - function sc_search_button($parm=null) + function sc_search_button($parm=array()) { - $class = isset($parm['class']) ? $parm['class'] : 'btn-default btn-secondary button search'; - return e107::getForm()->button('s','Search','submit', LAN_SEARCH, ['class'=>$class]); - // return ""; + if(!isset($parm['class'])) + { + $parm['class'] = 'btn-default btn-secondary button search'; + } + + $label = LAN_SEARCH; + + if(isset($parm['label'])) + { + $label = (strpos($parm['label'], '.glyph')!==false) ? e107::getParser()->toGlyph($parm['label'],'') : LAN_SEARCH; + unset($parm['label']); + } + + return e107::getForm()->button('s','Search','submit', $label, $parm); }