Skip to content

Commit

Permalink
widgets/Alert增加simple支持
Browse files Browse the repository at this point in the history
  • Loading branch information
hail committed Apr 25, 2020
1 parent 79bfe56 commit 510d2c7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/widgets/Alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class Alert extends Widget
*/
public $body;

/**
* @var bool whether or not the body has the head
*/
public $simple = false;

/**
* @var array|false the options for rendering the close button tag.
*
Expand All @@ -60,9 +65,13 @@ public function init()

public function run()
{
$icon = '<h5><i class="icon fas '.$this->alertTypes[$this->type]['icon'].'"></i> '.$this->title.'!</h5>';
$head = '';
if (!$this->simple) {
$head = '<h5><i class="icon fas '.$this->alertTypes[$this->type]['icon'].'"></i> '.$this->title.'!</h5>';
}

echo \yii\bootstrap4\Alert::widget([
'body' => $icon.$this->body,
'body' => $head.$this->body,
'closeButton' => $this->closeButton,
'options' => [
'id' => $this->getId().'-'.$this->type,
Expand Down

0 comments on commit 510d2c7

Please sign in to comment.