From 7f7c3694be771b24bc1f5cb40c0b8a7d79fe084e Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 21 Oct 2019 10:23:58 -0600 Subject: [PATCH] Add a little documentation to the Button class. --- resources/classes/button.php | 39 ++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/resources/classes/button.php b/resources/classes/button.php index 9abc59e439..dda644292d 100644 --- a/resources/classes/button.php +++ b/resources/classes/button.php @@ -46,7 +46,9 @@ if (!class_exists('button')) { $button .= ">"; //icon if ($array['icon'] && ( - $button_icons != 'never' || + $button_icons == 'only' || + $button_icons == 'always' || + $button_icons == 'auto' || !$array['label'] )) { $icon_class = is_array($array['icon']) ? $array['icon']['text'] : 'fas fa-'.$array['icon']; @@ -58,7 +60,7 @@ if (!class_exists('button')) { !$array['icon'] || $array['class'] == 'link' )) { - $hide_class = $array['icon'] && $button_icons != 'always' && $button_icons != 'never' ? 'hide-md-dn' : null; + $hide_class = $array['icon'] && $button_icons != 'always' && $button_icons != 'never' ? 'hide-sm' : null; $pad_class = $array['icon'] ? 'pad' : null; $button .= "".$array['label'].""; } @@ -76,9 +78,38 @@ if (!class_exists('button')) { } /* -//usage example (all possible options) +//usage -echo button::create(['type'=>'button','label'=>$label,'icon'=>'icon','name'=>'btn','id'=>'btn','value'=>'value','link'=>'url','target'=>'_blank','onclick'=>'action','class'=>'name','style'=>'css','title'=>'title']); + echo button::create(['type'=>'button','label'=>$text['button-label'],'icon'=>'icon','name'=>'btn','id'=>'btn','value'=>'value','link'=>'url','target'=>'_blank','onclick'=>'javascript','class'=>'name','style'=>'css','title'=>$text['button-label']]); + + echo button::create([ + 'type'=>'button', + 'label'=>$text['button-label'], + 'icon'=>'icon', + 'name'=>'btn', + 'id'=>'btn', + 'value'=>'value', + 'link'=>'url', + 'target'=>'_blank', + 'onclick'=>'javascript', + 'class'=>'name', + 'style'=>'css', + 'title'=>$text['button-label'] + ]); + +//options + + note: all are parameters are optional, but at least set a value for label or icon + + type 'button' (default) | 'submit' | 'link' + label button text + icon name without vendor prefix (e.g. 'user' instead of 'fa-user') + value submitted value (if type is also set to 'submit') + target '_blank' | '_self' (default) | etc + onclick javascript + class css class[es] + style css style[s] + title tooltip text (if not set, defaults to value of label) */