1 | <?php |
||
24 | class Alert extends Widget |
||
25 | { |
||
26 | /** |
||
27 | * @var array the alert types configuration for the flash messages. |
||
28 | * This array is setup as $key => $value, where: |
||
29 | * - $key is the name of the session flash variable |
||
30 | * - $value is the array: |
||
31 | * - class of alert type (i.e. danger, success, info, warning) |
||
32 | * - icon for alert AdminLTE |
||
33 | */ |
||
34 | public $alertTypes = [ |
||
35 | 'error' => [ |
||
36 | 'class' => 'alert-danger', |
||
37 | 'icon' => '<i class="icon fa fa-ban"></i>', |
||
38 | ], |
||
39 | 'danger' => [ |
||
40 | 'class' => 'alert-danger', |
||
41 | 'icon' => '<i class="icon fa fa-ban"></i>', |
||
42 | ], |
||
43 | 'success' => [ |
||
44 | 'class' => 'alert-success', |
||
45 | 'icon' => '<i class="icon fa fa-check"></i>', |
||
46 | ], |
||
47 | 'info' => [ |
||
48 | 'class' => 'alert-info', |
||
49 | 'icon' => '<i class="icon fa fa-info"></i>', |
||
50 | ], |
||
51 | 'warning' => [ |
||
52 | 'class' => 'alert-warning', |
||
53 | 'icon' => '<i class="icon fa fa-warning"></i>', |
||
54 | ], |
||
55 | ]; |
||
56 | |||
57 | /** |
||
58 | * @var array the options for rendering the close button tag. |
||
59 | */ |
||
60 | public $closeButton = [ |
||
61 | 'label' => '<i class="fa fa-times"></i>', |
||
62 | ]; |
||
63 | |||
64 | /** |
||
65 | * Initializes the widget. |
||
66 | * This method will register the bootstrap asset bundle. If you override this method, |
||
67 | * make sure you call the parent implementation first. |
||
68 | */ |
||
69 | public function init() |
||
96 | } |
||
97 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: