Add a little documentation to the Button class.
This commit is contained in:
parent
784aabca7e
commit
30bd7f8ff8
|
|
@ -46,7 +46,9 @@ if (!class_exists('button')) {
|
||||||
$button .= ">";
|
$button .= ">";
|
||||||
//icon
|
//icon
|
||||||
if ($array['icon'] && (
|
if ($array['icon'] && (
|
||||||
$button_icons != 'never' ||
|
$button_icons == 'only' ||
|
||||||
|
$button_icons == 'always' ||
|
||||||
|
$button_icons == 'auto' ||
|
||||||
!$array['label']
|
!$array['label']
|
||||||
)) {
|
)) {
|
||||||
$icon_class = is_array($array['icon']) ? $array['icon']['text'] : 'fas fa-'.$array['icon'];
|
$icon_class = is_array($array['icon']) ? $array['icon']['text'] : 'fas fa-'.$array['icon'];
|
||||||
|
|
@ -58,7 +60,7 @@ if (!class_exists('button')) {
|
||||||
!$array['icon'] ||
|
!$array['icon'] ||
|
||||||
$array['class'] == 'link'
|
$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;
|
$pad_class = $array['icon'] ? 'pad' : null;
|
||||||
$button .= "<span class='button-label ".$hide_class." ".$pad_class."'>".$array['label']."</span>";
|
$button .= "<span class='button-label ".$hide_class." ".$pad_class."'>".$array['label']."</span>";
|
||||||
}
|
}
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue