1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-19 12:11:55 +02:00

Added support for custom titles in message handler.

This commit is contained in:
Cameron 2014-02-21 06:16:22 -08:00
parent fa26a3fb24
commit ccc2f53eca

View File

@ -78,6 +78,13 @@ class eMessage
* @var array
*/
protected $_unique = array();
/**
* @var array
*/
static $_customTitle = array();
/**
* Singleton instance
@ -367,12 +374,34 @@ class eMessage
*/
public static function getTitle($type, $message_stack = 'default')
{
if(!empty(self::$_customTitle[$type]))
{
return self::$_customTitle[$type];
}
if($message_stack && $message_stack != 'default' && defined('EMESSLAN_TITLE_'.strtoupper($type.'_'.$message_stack)))
{
return constant('EMESSLAN_TITLE_'.strtoupper($type.'_'.$message_stack));
}
return defsettrue('EMESSLAN_TITLE_'.strtoupper($type), '');
}
/**
* Set a custom title/caption (useful for front-end)
*
* @param string $title
* @param string $type E_MESSAGE_SUCCESS,E_MESSAGE_ERROR, E_MESSAGE_WARNING, E_MESSAGE_INFO
* @example e107::getMessage()->setTitle('Custom Title', E_MESSAGE_INFO);
*/
public function setTitle($title, $type)
{
$tp = e107::getParser();
self::$_customTitle[$type] = $tp->toText($title);
return $this;
}
/**
* Message getter