[NFR] Implement Phalcon\Flash\Direct::output() method
Issue is based on the forum discussion Also it shouls be implemented in \Phalcon\FlashInterface
I will close this issue if you don't want implement it because there are some similar closed issues #565 #278 , but I think this feature will be useful for output flash messages in the main layout or absolutely any place
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I agree with this, I want to wrap some HTML around the flash message that I want a check statement to see if its set. I do not want to put HTML code in my controller. I would support this.
I to support this :+1:
But why don't you use Flash\Session? It is much more suitable for that.
I just noticed yesterday class Flash\Session and I'm use getMessage() method for ajax response :) thx Yes, Flash\Session is more suitable for that then Flash\Direct. But: If I want return all messages and all types (exp Warnings and Notice) I use this code:
$_errorMessages = $this->flashSession->getMessages('error', false);
$_warningMessages = $this->flashSession->getMessages('warning', false);
$_successMessages = $this->flashSession->getMessages('success', false);
$_noticeMessages = $this->flashSession->getMessages('notice', false);
I send Form and first request return success messages(exemple), second request return error messages - I get success message in form (when in fact the form was submitted in error), because I save all messages from different requests. If I remove messages:
getMessages('error', true);
I dont get multiply messages, because i think boolean parameter delete all messages in Session(not only 'error' type)
I agree too! Please implement output method for Flash\Direct!
At the very least, it'll make views cleaner as there will be an obvious place for flash messages to be rendered.
+1
+1
This is implemented in 2.0.x (2.0.4).
It requires initialize the flasher with $flash->useImplicitFlush(false);