Abstract Class humhub\widgets\BootstrapComponent

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

BootstrapComponent is an abstract class used to define bootstrap based ui components and provides common features as sizing, color, text and alignment configuration.

This class follows the builder pattern for instantiation and configuration. By default this class provides the following static initializers:

  • none
  • primary
  • defaultType
  • info
  • warn
  • danger

Example:

// Set only text
BootstrapComponent::instance('My Label')->right();

// Component with primary color and text
BootstrapComponent::primary('My Label');

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__toString() humhub\widgets\BootstrapComponent
asColor() humhub\widgets\BootstrapComponent
asString() humhub\widgets\BootstrapComponent
color() humhub\widgets\BootstrapComponent
cssClass() humhub\widgets\BootstrapComponent
danger() humhub\widgets\BootstrapComponent
defaultType() humhub\widgets\BootstrapComponent
getComponentBaseClass() humhub\widgets\BootstrapComponent
getLayoutViewParams() Returns an array of view parameter used if \humhub\components\layout is set. humhub\components\Widget
getTypedClass() humhub\widgets\BootstrapComponent
getWidgetOptions() humhub\widgets\BootstrapComponent
icon() humhub\widgets\BootstrapComponent
id() humhub\widgets\BootstrapComponent
info() humhub\widgets\BootstrapComponent
instance() humhub\widgets\BootstrapComponent
left() humhub\widgets\BootstrapComponent
lg() humhub\widgets\BootstrapComponent
none() humhub\widgets\BootstrapComponent
options() humhub\widgets\BootstrapComponent
primary() humhub\widgets\BootstrapComponent
process() Process is a wrapper for the run method humhub\components\Widget
renderComponent() humhub\widgets\BootstrapComponent
right() humhub\widgets\BootstrapComponent
run() humhub\widgets\BootstrapComponent
setText() humhub\widgets\BootstrapComponent
setType() humhub\widgets\BootstrapComponent
sm() humhub\widgets\BootstrapComponent
style() humhub\widgets\BootstrapComponent
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
visible() humhub\widgets\BootstrapComponent
warning() humhub\widgets\BootstrapComponent
widget() Creates a widget instance and runs it. humhub\components\Widget
xs() humhub\widgets\BootstrapComponent

Events

Hide inherited events

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

Constants

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

$_icon public property
public $_icon null
$_iconRight public property
public $_iconRight null
$_visible public property
public $_visible true
$encode public property
public $encode false
$htmlOptions public property
public $htmlOptions = []
$text public property
public $text null
$type public property
public $type null

Method Details

__toString() public method

public string __toString ( )
throws Exception
asColor() public static method

public static $this asColor ( $color, $text null )
$color
$text null
asString() public method (available since version 1.4)

public string asString ( )
color() public method

public void color ( $color )
$color
cssClass() public method

public $this cssClass ( $cssClass )
$cssClass
danger() public static method

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

Button text

defaultType() public static method

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

Button text

getComponentBaseClass() public abstract method

public abstract string getComponentBaseClass ( )
return string

The bootstrap css base class

getText() protected method

protected void getText ( )
getTypedClass() public abstract method

public abstract string getTypedClass ( $type )
$type
return string

The bootstrap css class by $type

getWidgetOptions() public method

public array getWidgetOptions ( )
return array

All options required for rendering the widget

icon() public method

public $this icon ( $content, $right false, $raw false )
$content
$right boolean
$raw boolean
throws Exception
id() public method

public $this id ( $id )
$id
info() public static method

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

Button text

instance() public static method

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

Button text

left() public method

public $this left ( $left true )
$left boolean
lg() public method

public $this lg ( )
none() public static method

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

Button text

options() public method

public $this options ( $options )
$options
primary() public static method

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

Button text

renderComponent() public abstract method

public abstract string renderComponent ( )
return string

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

right() public method

public $this right ( $right true )
$right boolean
run() public method

public void run ( )
setCssClass() protected method

protected void setCssClass ( )
setText() public method

public $this setText ( $text )
$text
setType() public method

public void setType ( $type )
$type
sm() public method

public $this sm ( )
style() public method

public $this style ( $style )
$style
success() public static method

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

Button text

textColor() public method

public void textColor ( $color )
$color
title() public method (available since version 1.3)

Adds an html title attribute

public $this title ( $title )
$title
tooltip() public method (available since version 1.3)

Adds an title + tooltip behaviour class

public $this tooltip ( $title )
$title
visible() public method

public void visible ( $isVisible true )
$isVisible
warning() public static method

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

Button text

xs() public method

public $this xs ( )