Class vitalik74\primer\Alerts
Inheritance | vitalik74\primer\Alerts » yii\base\Object |
---|---|
Uses Traits | vitalik74\primer\UtilsTrait |
Class provide simple interface for show alert.
In class use trait \vitalik74\primer\vitalik74\primer\UtilsTrait.
Example use in your view:
<?php
use vitalik74\primer\Alerts;
?>
<div class="site-avatar">
<?= Alerts::alert('simple alert', ['id' => 'simple_alert'], 'warm') ?>
<?= Alerts::alert('simple alert2', ['id' => 'simple_alert2'], 'error') ?>
<?= Alerts::alertWithIcon('simple alert icon', ['id' => 'simple_alert_icon']) ?>
<?= Alerts::alertWithDismiss('simple alert dismiss', ['id' => 'simple_alert_dismiss'], 'warm') ?>
<?= Alerts::alertWithDismiss('simple alert', ['id' => 'simple_alert_dismiss2'], 'error') ?>
</div>
See also http://primercss.io/alerts/.
Public Methods
Method | Description | Defined By |
---|---|---|
alert() | Return html code with alert | vitalik74\primer\Alerts |
alertWithDismiss() | Return html code with alert with dismiss | vitalik74\primer\Alerts |
alertWithIcon() | Return html code with alert with icon | vitalik74\primer\Alerts |
getType() | If isset $type return value of $types[$type] |
vitalik74\primer\UtilsTrait |
getTypeFromArray() | vitalik74\primer\UtilsTrait |
Method Details
Return html code with alert
<?php
use vitalik74\primer\Alerts;
?>
<?= Alerts::alert('simple alert', ['id' => 'simple_alert'], 'warm') ?>
See also http://primercss.io/alerts/#default.
string alert( $content, $options = [], $type = '' ) | ||
$content | string | Content to include in container |
$options | array | Keys-values pair of options use in \yii\helpers\Html::tag() |
$type | string | Type of special class. Possible values: warm, error, icon. Note: warm and error is a synonym |
Return html code with alert with dismiss
<?php
use vitalik74\primer\Alerts;
?>
<?= Alerts::alertWithDismiss('simple alert', ['id' => 'simple_alert_dismiss2'], 'error') ?>
See also http://primercss.io/alerts/#dismiss.
string alertWithDismiss( $content, $options = [], $type = '' ) | ||
$content | string | Content to include in container |
$options | array | Keys-values pair of options use in \yii\helpers\Html::tag() |
$type | string | Type of special class. Possible values: warm, error, icon. Note: warm and error is a synonym |
Return html code with alert with icon
<?php
use vitalik74\primer\Alerts;
?>
<?= Alerts::alertWithIcon('simple alert icon', ['id' => 'simple_alert_icon']) ?>
See also http://primercss.io/alerts/#with-icon.
string alertWithIcon( $content, $options = [], $contentIcon = '' ) | ||
$content | string | Content to include in container |
$options | array | Keys-values pair of options use in \yii\helpers\Html::tag() |
$contentIcon | string | Content container |