File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 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
2424 foundation - [https://foundation.zurb.com/sites/docs/callout.html#making-closable]
2525*/
2626 public $ template = "Tatter\Alerts\Views\bootstrap " ;
27+
28+ // Whether to check session flashdata for common alert keys
29+ public $ getflash = true ;
2730}
Original file line number Diff line number Diff line change @@ -104,6 +104,26 @@ public function display()
104104 // clear alerts
105105 $ this ->session ->remove ($ this ->config ->prefix . 'queue ' );
106106
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+
107127 if (empty ($ alerts ))
108128 return ;
109129
Original file line number Diff line number Diff line change @@ -9,4 +9,7 @@ class Alerts extends BaseConfig
99
1010 // Template to use for HTML output
1111 public $ template = "Tatter\Alerts\Views\bootstrap " ;
12+
13+ // Whether to check session flashdata for common alert keys
14+ public $ getflash = true ;
1215}
You can’t perform that action at this time.
0 commit comments