diff --git a/docs/50_Forms/Select.md b/docs/50_Forms/Select.md index 415a7f312baf18ebb6511bff41847cc410531e1a..2846bcb7ffdc5add396a80457c2f9fa7c3b1438b 100644 --- a/docs/50_Forms/Select.md +++ b/docs/50_Forms/Select.md @@ -26,6 +26,7 @@ Styling for select tag: Key | Description --- | --- +bootstrap-select | optional: use bootstrap-select pugin with live search (you need to load the plugin in your page) class | optional: additional css classes size | optional: visible option lines diff --git a/public_html/classes/render-adminlte.class.php b/public_html/classes/render-adminlte.class.php index 1035af9dac0f6e7adc4704f6e9cca0fa36851aca..d319b975ca97a21749d2510ab76487efb77f0b9c 100755 --- a/public_html/classes/render-adminlte.class.php +++ b/public_html/classes/render-adminlte.class.php @@ -12,6 +12,7 @@ require_once 'htmlelements.class.php'; * 2023-09-27 <axel.hahn@unibe.ch> add form input fields * 2023-11-17 <axel.hahn@unibe.ch> add tabbed content; "=" renders hamburger item * 2024-05-03 <axel.hahn@unibe.ch> add line in sidebar menu; add getFormSelect + * 2024-05-10 <axel.hahn@unibe.ch> add support for bootstrap-select in getFormSelect * ====================================================================== * * @author Axel @@ -399,10 +400,6 @@ class renderadminlte { 'description'=>'type or input field', 'group'=>'styling', 'values'=>[ - 'text'=>'text', - 'password'=>'password', - 'email'=>'email', - 'hidden'=>'hidden', 'button'=>'button', 'checkbox'=>'checkbox', @@ -861,7 +858,11 @@ class renderadminlte { /** * helper function for get[COMPONENTNAME] methods: - * ensure that all wanted keys exist in an array. Non existing keys will be added with value false + * ensure that all wanted keys exist in an array. Non existing keys will + * be added with value false + * + * @param string $sComponent id of the component + * @param array $aOptions hash with keys for all options * @return array */ protected function _ensureOptions($sComponent, $aOptions=[]){ @@ -903,7 +904,7 @@ class renderadminlte { * return a alert box * https://adminlte.io/themes/v3/pages/UI/general.html * - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * - type - one of [none]|danger|info|primary|success|warning * - dismissible - if dismissible - one of true|false; default: false * - title @@ -953,6 +954,7 @@ class renderadminlte { * - text - visible text * - title - optional: title attribute * - type - one of [none]|danger|dark|info|primary|secondary|success|warning + * @return string */ public function getBadge($aOptions){ $aOptions=$this->_ensureOptions('badge', $aOptions); @@ -978,7 +980,7 @@ class renderadminlte { * https://adminlte.io/themes/v3/pages/UI/buttons.html * * <button type="button" class="btn btn-block btn-default">Default</button> - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * - type - one of [none]|danger|dark|info|primary|secondary|success|warning * - size - one of [none]|lg|sm|xs|flat * - class - any css class for customizing, eg. "disabled" @@ -1005,7 +1007,7 @@ class renderadminlte { * get a callout (box with coloered left border; has type, title + text) * https://adminlte.io/themes/v3/pages/UI/general.html * - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * >> styling * - type - one of [none]|danger|dark|info|primary|secondary|success|warning * - class - optional css class @@ -1036,7 +1038,7 @@ class renderadminlte { * https://adminlte.io/docs/3.2/components/cards.html * https://adminlte.io/docs/3.2/javascript/card-widget.html * - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * >> styling * - variant: "default" - titlebar is colored * "outline" - a small stripe on top border is colored @@ -1186,7 +1188,7 @@ class renderadminlte { * https://adminlte.io/docs/3.2/components/boxes.html * https://adminlte.io/themes/v3/pages/widgets.html * - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * styling: * - type - color of the box; one of [none]|danger|dark|info|primary|secondary|success|warning * - shadow - size of shadow; one of [none] (=default: between small and regular)|none|small|regular|large @@ -1364,13 +1366,16 @@ class renderadminlte { /** * return a select box field * @param array $aOptions hash with keys for all options - * styling: - * - class - css class * option fields * - options - array of options with keys per item: * - value - value in the option * - label - visible text in the option * other keys are attributes in the option + * styling: + * - bootstrap-select - set true to enable select + * box with bootstrap-select and + * live search + * - class - css class * select tag * - label - label tag * - name - name attribute for sending form @@ -1382,7 +1387,11 @@ class renderadminlte { $aElement['class']='' . 'form-control ' . (isset($aOptions['class']) ? $aOptions['class']: '') + . (isset($aOptions['bootstrap-select']) ? 'selectpicker ': '') //$aOptions ; + if(isset($aOptions['bootstrap-select']) && $aOptions['bootstrap-select']){ + $aElement['data-live-search']="true"; + } $sLabel=isset($aOptions['label']) ? $aOptions['label'] : ''; $sFormid=(isset($aOptions['id'])