Commit ff6bf11 committed Dec 16, 2019 Verified
1 parent 10d1206 commit ff6bf11 Copy full SHA for ff6bf11
File tree 3 files changed +26
-0
lines changed
3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -24,4 +24,7 @@ class Alerts extends \Tatter\Alerts\Config\Alerts
24
24
foundation - [https://foundation.zurb.com/sites/docs/callout.html#making-closable]
25
25
*/
26
26
public $ template = "Tatter\Alerts\Views\bootstrap " ;
27
+
28
+ // Whether to check session flashdata for common alert keys
29
+ public $ getflash = true ;
27
30
}
Original file line number Diff line number Diff line change @@ -104,6 +104,26 @@ public function display()
104
104
// clear alerts
105
105
$ this ->session ->remove ($ this ->config ->prefix . 'queue ' );
106
106
107
+ // Check for flashdata (if configured)
108
+ if ($ this ->config ->getflash )
109
+ {
110
+ if ($ message = $ this ->session ->getFlashdata ('message ' ))
111
+ {
112
+ $ alerts [] = ['class ' => 'info ' , 'text ' => $ message ];
113
+ }
114
+ elseif ($ error = $ this ->session ->getFlashdata ('error ' ))
115
+ {
116
+ $ alerts [] = ['class ' => 'danger ' , 'text ' => $ error ];
117
+ }
118
+ elseif ($ errors = $ this ->session ->getFlashdata ('errors ' ))
119
+ {
120
+ foreach ($ errors as $ error )
121
+ {
122
+ $ alerts [] = ['class ' => 'danger ' , 'text ' => $ error ];
123
+ }
124
+ }
125
+ }
126
+
107
127
if (empty ($ alerts ))
108
128
return ;
109
129
Original file line number Diff line number Diff line change @@ -9,4 +9,7 @@ class Alerts extends BaseConfig
9
9
10
10
// Template to use for HTML output
11
11
public $ template = "Tatter\Alerts\Views\bootstrap " ;
12
+
13
+ // Whether to check session flashdata for common alert keys
14
+ public $ getflash = true ;
12
15
}
You can’t perform that action at this time.
0 commit comments