Class humhub\widgets\Button

Inheritancehumhub\widgets\Button » humhub\widgets\BootstrapComponent » humhub\components\Widget » yii\base\Widget
Subclasseshumhub\modules\file\widgets\FileDownload, humhub\widgets\Link, humhub\widgets\ModalButton

Helper class for creating buttons.


<?= Button::primary('Some Text')->actionClick('myHandler', [/some/url])->sm() ?>

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__toString() humhub\widgets\BootstrapComponent
action() Adds a data-action-click handler to the button. humhub\widgets\Button
asColor() humhub\widgets\BootstrapComponent
asLink() humhub\widgets\Button
asString() humhub\widgets\BootstrapComponent
back() humhub\widgets\Button
color() humhub\widgets\BootstrapComponent
confirm() Adds a confirmation behaviour to the button. humhub\widgets\Button
cssClass() humhub\widgets\BootstrapComponent
danger() humhub\widgets\BootstrapComponent
defaultType() humhub\widgets\BootstrapComponent
getComponentBaseClass() humhub\widgets\Button
getHref() humhub\widgets\Button
getLayoutViewParams() Returns an array of view parameter used if \humhub\components\layout is set. humhub\components\Widget
getTypedClass() humhub\widgets\Button
getWidgetOptions() humhub\widgets\Button
icon() humhub\widgets\BootstrapComponent
id() humhub\widgets\BootstrapComponent
info() humhub\widgets\BootstrapComponent
instance() humhub\widgets\BootstrapComponent
isPjaxEnabled() humhub\widgets\Button
left() humhub\widgets\BootstrapComponent
lg() humhub\widgets\BootstrapComponent
link() humhub\widgets\Button
loader() humhub\widgets\Button
none() humhub\widgets\BootstrapComponent
onAction() Adds a data-action-* handler to the button. humhub\widgets\Button
options() humhub\widgets\BootstrapComponent
pjax() If set to false the [data-pjax-prevent] flag is attached to the link. humhub\widgets\Button
primary() humhub\widgets\BootstrapComponent
process() Process is a wrapper for the run method humhub\components\Widget
renderComponent() humhub\widgets\Button
right() humhub\widgets\BootstrapComponent
run() humhub\widgets\BootstrapComponent
save() humhub\widgets\Button
setText() humhub\widgets\BootstrapComponent
setType() humhub\widgets\BootstrapComponent
sm() humhub\widgets\BootstrapComponent
style() humhub\widgets\BootstrapComponent
submit() humhub\widgets\Button
success() humhub\widgets\BootstrapComponent
textColor() humhub\widgets\BootstrapComponent
title() Adds an html title attribute humhub\widgets\BootstrapComponent
tooltip() Adds an title + tooltip behaviour class humhub\widgets\BootstrapComponent
userPickerSelfSelect() humhub\widgets\Button
visible() humhub\widgets\BootstrapComponent
warning() humhub\widgets\BootstrapComponent
widget() Creates a widget instance and runs it. humhub\components\Widget
xs() humhub\widgets\BootstrapComponent


Hide inherited events

EventTypeDescriptionDefined By
EVENT_CREATE humhub\libs\WidgetCreateEvent An event raised before creating a widget. humhub\components\Widget


Hide inherited constants

ConstantValueDescriptionDefined By
TYPE_DANGER 'danger' humhub\widgets\BootstrapComponent
TYPE_DEFAULT 'default' humhub\widgets\BootstrapComponent
TYPE_INFO 'info' humhub\widgets\BootstrapComponent
TYPE_NONE 'none' humhub\widgets\BootstrapComponent
TYPE_PRIMARY 'primary' humhub\widgets\BootstrapComponent
TYPE_SUCCESS 'success' humhub\widgets\BootstrapComponent
TYPE_WARNING 'warning' humhub\widgets\BootstrapComponent

Property Details

public $_link false
$_loader public property
public $_loader true

Method Details

action() public method

Adds a data-action-click handler to the button.

public static action ( $handler, $url null, $target null )
$url null
$target null
asLink() public static method

public static static asLink ( $text null, $href '#' )
$text string

Button text

$href string
back() public static method

public static static back ( $url, $text null )
$text string

Button text

throws Exception
confirm() public method

Adds a confirmation behaviour to the button.

public $this confirm ( $title null, $body null, $confirmButtonText null, $cancelButtonText null )
$title null
$body null
$confirmButtonText null
$cancelButtonText null
getComponentBaseClass() public method

public string getComponentBaseClass ( )
return string

The bootstrap css base class

getHref() public method

public null getHref ( )
getTypedClass() public method

public string getTypedClass ( $type )
return string

The bootstrap css class by $type

getWidgetOptions() public method

public void getWidgetOptions ( )
isPjaxEnabled() public method (available since version 1.4)

public boolean isPjaxEnabled ( )
link() public method

public $this link ( $url null, $pjax true )
$url null
loader() public method

public $this loader ( $active true )
$active boolean
onAction() public method

Adds a data-action-* handler to the button.

public $this onAction ( $event, $handler, $url null, $target null )
$url null
$target null
pjax() public method

If set to false the [data-pjax-prevent] flag is attached to the link.

public $this pjax ( $pjax true )
$pjax boolean
renderComponent() public method

public string renderComponent ( )
return string

Renders and returns the actual html element by means of the current settings

save() public static method

public static static save ( $text null )
$text string

Button text

submit() public method

public $this submit ( )
userPickerSelfSelect() public static method

public static void userPickerSelfSelect ( $selector, $text null )