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