cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[NFR] Implement Phalcon\Flash\Direct::output() method

Open iforp opened this issue 13 years ago • 9 comments

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.

iforp avatar May 13 '13 08:05 iforp

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.

Slyvampy avatar Nov 07 '13 12:11 Slyvampy

I to support this :+1:

romanlex avatar Nov 20 '13 20:11 romanlex

But why don't you use Flash\Session? It is much more suitable for that.

ghost avatar Nov 20 '13 21:11 ghost

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)

romanlex avatar Nov 21 '13 08:11 romanlex

I agree too! Please implement output method for Flash\Direct!

aledelgo avatar Jan 23 '14 14:01 aledelgo

At the very least, it'll make views cleaner as there will be an obvious place for flash messages to be rendered.

troyswanson avatar Jan 27 '14 05:01 troyswanson

+1

ryanwalters avatar Jun 30 '14 17:06 ryanwalters

+1

pisklov avatar Jun 07 '15 11:06 pisklov

This is implemented in 2.0.x (2.0.4).

It requires initialize the flasher with $flash->useImplicitFlush(false);

andresgutierrez avatar Jun 16 '15 21:06 andresgutierrez