1 | <?php |
||
32 | class Flashes extends \yii\bootstrap\Widget |
||
33 | { |
||
34 | /** |
||
35 | * @var array the alert types configuration for the flash messages. |
||
36 | * This array is setup as $key => $value, where: |
||
37 | * - $key is the name of the session flash variable |
||
38 | * - $value is the bootstrap alert type (i.e. danger, success, info, warning) |
||
39 | */ |
||
40 | public $alertTypes = [ |
||
41 | 'error' => 'alert-danger', |
||
42 | 'danger' => 'alert-danger', |
||
43 | 'success' => 'alert-success', |
||
44 | 'info' => 'alert-info', |
||
45 | 'warning' => 'alert-warning', |
||
46 | ]; |
||
47 | |||
48 | /** |
||
49 | * @var array the options for rendering the close button tag |
||
50 | */ |
||
51 | public $closeButton = []; |
||
52 | |||
53 | /** |
||
54 | * @param mixed $message Flash value to be normalized |
||
55 | * @return array |
||
56 | */ |
||
57 | public function normalizeMessage($message) |
||
68 | |||
69 | public function run() |
||
92 | } |
||
93 |
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: