Here's example:
class MyCoolFlash extends Phalcon\Flash implements Phalcon\FlashInterface
{
/**
* Contains all nonouputed messages
*/
private $messages = "";
//override constructor
public function __construct($cssClasses)
{
parent::__construct($cssClasses);
parent::setImplicitFlush(false); // don't output when parent::outputMessage() called
parent::setAutomaticHtml(true); // enable html because of disabled by default
}
public function error($message)
{
$this->messages .= parent::error($message);
}
// and other types ...
public function output()
{
return $this->messages;
}
$di['flash'] = function() {
$flash = new MyCoolFlash ([
'error' => 'alert-direct error',
'notice' => 'alert-direct notice',
'success' => 'alert-direct success',
'warning' => 'alert-direct warning',
]);
return $flash;
};