mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Message Handler enhancement - render specific types.
This commit is contained in:
parent
c3e7104c64
commit
883e4eb0c8
@ -443,30 +443,33 @@ class eMessage
|
||||
}
|
||||
|
||||
/**
|
||||
* Output all accumulated messages
|
||||
* Output all accumulated messages OR a specific type of messages. eg. 'info', 'warning', 'error', 'success'
|
||||
*
|
||||
* @param string $mstack message stack name
|
||||
* @param bool $session merge with session messages
|
||||
* @param bool|string $options - true : merge with session messages or enter a type 'info', 'warning', 'error', 'success'
|
||||
* @param bool $reset reset all messages
|
||||
* @param bool $raw force return type array
|
||||
* @return array|string messages
|
||||
*/
|
||||
public function render($mstack = 'default', $session = false, $reset = true, $raw = false)
|
||||
public function render($mstack = 'default', $options = false, $reset = true, $raw = false)
|
||||
{
|
||||
if($session)
|
||||
if($options === true )
|
||||
{
|
||||
$this->mergeWithSession(true, $mstack);
|
||||
}
|
||||
$ret = array();
|
||||
$unique = array();
|
||||
foreach ($this->_get_types() as $type)
|
||||
|
||||
$typesArray = (is_string($options) && in_array($options, $this->_get_types())) ? array($options) : $this->_get_types();
|
||||
|
||||
foreach ($typesArray as $type)
|
||||
{
|
||||
if(E_MESSAGE_DEBUG === $type && !deftrue('E107_DEBUG_LEVEL'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$message = $this->get($type, $mstack, $raw);
|
||||
|
||||
|
||||
if(!empty($message))
|
||||
{
|
||||
$ret[$type] = $message;
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
|
||||
$mes = e107::getMessage();
|
||||
echo $mes->render();
|
||||
echo $mes->render('default','info',false);
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user