Add into MsgViewHelper.getType() and use_as_html protected var.
This commit is contained in:
@ -18,6 +18,8 @@ class MsgViewHelper extends ViewHelper
|
|||||||
|
|
||||||
const WARNING = 'warning';
|
const WARNING = 'warning';
|
||||||
|
|
||||||
|
protected $use_as_html = false;
|
||||||
|
|
||||||
private static $type_to_class = array(
|
private static $type_to_class = array(
|
||||||
self::SUCCESS => 'success',
|
self::SUCCESS => 'success',
|
||||||
self::ERROR => 'error',
|
self::ERROR => 'error',
|
||||||
@ -63,6 +65,12 @@ class MsgViewHelper extends ViewHelper
|
|||||||
Session::set(__CLASS__, array('message' => $msg, 'type' => $type));
|
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)
|
public function withPrefix($css_prefix)
|
||||||
{
|
{
|
||||||
$this->css_prefix = $css_prefix;
|
$this->css_prefix = $css_prefix;
|
||||||
@ -75,7 +83,7 @@ class MsgViewHelper extends ViewHelper
|
|||||||
if ($msg) {
|
if ($msg) {
|
||||||
Session::del(__CLASS__);
|
Session::del(__CLASS__);
|
||||||
$type_to_class = static::getTypeToClass();
|
$type_to_class = static::getTypeToClass();
|
||||||
return '<div class="' . $this->css_prefix . $type_to_class[$msg['type']] . '">' . $this->view->escape($msg['message']) . '</div>';
|
return '<div class="' . $this->css_prefix . $type_to_class[$msg['type']] . '">' . (($this->use_as_html)?$msg['message']:$this->view->escape($msg['message'])) . '</div>';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user