Class vitalik74\primer\Button

Inheritancevitalik74\primer\Button » yii\base\Object
Uses Traitsvitalik74\primer\UtilsTrait

Provide html code to show buttons.

In class use trait \vitalik74\primer\vitalik74\primer\UtilsTrait.

Example use in your view:

<?php
use vitalik74\primer\Button;
?>

<div class="site-button">
<?= Button::button('simple button') ?>
<?= Button::button('primary button', 'primary', ['id' => 'primary_button']) ?>
<?= Button::button('smallPrimary button', 'smallPrimary', ['id' => 'smallPrimary_button']) ?>
<?= Button::button('small button', 'small', ['id' => 'small_button']) ?>
<?= Button::button('smallDanger button', 'smallDanger', ['id' => 'smallDanger_button']) ?>
<?= Button::button('danger button', 'danger', ['id' => 'danger_button']) ?>
</div>

See also http://primercss.io/buttons.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
button() Render button vitalik74\primer\Button
getType() If isset $type return value of $types[$type] vitalik74\primer\UtilsTrait
getTypeFromArray() vitalik74\primer\UtilsTrait
linkButton() Render link button vitalik74\primer\Button

Method Details

button() public method

Render button

<?php
use vitalik74\primer\Button;
?>

<?= Button::button('simple button') ?>

See also http://primercss.io/buttons/#default-buttons.

string button$content ''$typeButton 'default'$options = [] )
$content string

Content to put between

$typeButton string

Possible values @see $_typeButtons

$options array

Html options in terms of name-value pairs

linkButton() public method

Render link button

<?php
use vitalik74\primer\Button;
?>

<?= Button::linkButton('simple button') ?>

See also http://primercss.io/buttons/#default-buttons.

string linkButton$content ''$typeButton 'default'$url null$options = [] )
$content string

$content content to put between

$typeButton string

Possible values 'default, primary, smallPrimary, small, smallDanger, danger'

$url array|string|null

Route from link

$options array

Html options in terms of name-value pairs