Flash-Funktionen in eigenes Package verschoben
[kivitendo-erp.git] / SL / Helper / Flash.pm
diff --git a/SL/Helper/Flash.pm b/SL/Helper/Flash.pm
new file mode 100644 (file)
index 0000000..8074232
--- /dev/null
@@ -0,0 +1,22 @@
+package SL::Helper::Flash;
+
+use strict;
+
+require Exporter;
+our @ISA    = qw(Exporter);
+our @EXPORT = qw(flash render_flash);
+
+sub flash {
+  my $category = shift;
+  $category    = 'info' if $category eq 'information';
+
+  $::form->{FLASH}                ||= { };
+  $::form->{FLASH}->{ $category } ||= [ ];
+  push @{ $::form->{FLASH}->{ $category } }, @_;
+}
+
+sub render_flash {
+  return $::form->parse_html_template('common/flash');
+}
+
+1;