Class vitalik74\primer\Button
| Inheritance | vitalik74\primer\Button » yii\base\Object |
|---|---|
| Uses Traits | vitalik74\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
| Method | Description | Defined 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
Render button
<?php
use vitalik74\primer\Button;
?>
<?= Button::button('simple button') ?>
| 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 |
Render link button
<?php
use vitalik74\primer\Button;
?>
<?= Button::linkButton('simple button') ?>
| string linkButton( $content = '', $typeButton = 'default', $url = null, $options = [] ) | ||
| $content | string | |
| $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 |