From ff76d8fa1d3c27f3ab08a402998c2ed4a8f2296e Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Thu, 10 Oct 2013 11:32:32 +0400 Subject: [PATCH] Add into MsgViewHelper.getType() and use_as_html protected var. --- view/helpers/MsgViewHelper.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/view/helpers/MsgViewHelper.php b/view/helpers/MsgViewHelper.php index 1283367..5b0f90f 100644 --- a/view/helpers/MsgViewHelper.php +++ b/view/helpers/MsgViewHelper.php @@ -18,6 +18,8 @@ class MsgViewHelper extends ViewHelper const WARNING = 'warning'; + protected $use_as_html = false; + private static $type_to_class = array( self::SUCCESS => 'success', self::ERROR => 'error', @@ -63,6 +65,12 @@ class MsgViewHelper extends ViewHelper Session::set(__CLASS__, array('message' => $msg, 'type' => $type)); } + public static function getType() + { + $msg = Session::get(__CLASS__, false); + return $msg ? $msg['type'] : ''; + } + public function withPrefix($css_prefix) { $this->css_prefix = $css_prefix; @@ -75,7 +83,7 @@ class MsgViewHelper extends ViewHelper if ($msg) { Session::del(__CLASS__); $type_to_class = static::getTypeToClass(); - return '
' . $this->view->escape($msg['message']) . '
'; + return '
' . (($this->use_as_html)?$msg['message']:$this->view->escape($msg['message'])) . '
'; } return ''; }