Phalcon flash
NOTE
All classes are prefixed with Phalcon
Flash\AbstractFlash¶
Abstract Source on GitHub
Shows HTML notifications related to different circumstances. Classes can be stylized using CSS
Class AbstractFlash
@package Phalcon\Flash
stdClassPhalcon\Di\AbstractInjectionAwarePhalcon\Flash\AbstractFlash— implementsPhalcon\Flash\FlashInterface
Uses Phalcon\Di\AbstractInjectionAware · Phalcon\Di\Di · Phalcon\Di\DiInterface · Phalcon\Flash\Exceptions\EscaperServiceUnavailable · Phalcon\Flash\Exceptions\FlashMessageNotStringOrArray · Phalcon\Html\Escaper\EscaperInterface · Phalcon\Session\ManagerInterface · Phalcon\Support\Helper\Str\Interpolate
Method Summary¶
public __construct(EscaperInterface $escaper = null,SessionInterface $session = null) AbstractFlash constructor. public void clear() Clears accumulated messages when implicit flush is disabled public string|null error( string $message ) Shows a HTML error message public bool getAutoescape() public bool getAutomaticHtml() public array getCssClasses() public array getCssIconClasses() public string getCustomTemplate() public EscaperInterface getEscaperService() Returns the Escaper Service public string|null message(string $type,mixed $message) Outputs a message. Delivery semantics differ per implementation: public string|null notice( string $message ) Shows a HTML notice/information message public string|null outputMessage(string $type,mixed $message) Outputs a message formatting it with HTML public static setAutoescape( bool $autoescape ) Set the autoescape mode in generated HTML public static setAutomaticHtml( bool $automaticHtml ) Set if the output must be implicitly formatted with HTML public static setCssClasses( array $cssClasses ) Set an array with CSS classes to format the messages public static setCssIconClasses( array $cssIconClasses ) Set an array with CSS classes to format the icon messages public static setCustomTemplate( string $customTemplate ) Set a custom template for showing the messages public static setEscaperService( EscaperInterface $escaperService ) Sets the Escaper Service public static setImplicitFlush( bool $implicitFlush ) Set whether the output must be implicitly flushed to the output or public string|null success( string $message ) Shows a HTML success message public string|null warning( string $message ) Shows a HTML warning message Properties¶
protected bool $autoescape = true protected bool $automaticHtml = true protected array $cssClasses = [] protected array $cssIconClasses = [] protected string $customTemplate = "" protected EscaperInterface | null $escaperService = null protected bool $implicitFlush = true protected Interpolate $interpolator protected array $messages = [] protected SessionInterface|null $sessionService = null Methods¶
__construct()¶
AbstractFlash constructor.
clear()¶
Clears accumulated messages when implicit flush is disabled
error()¶
Shows a HTML error message
getAutoescape()¶
getAutomaticHtml()¶
getCssClasses()¶
getCssIconClasses()¶
getCustomTemplate()¶
getEscaperService()¶
Returns the Escaper Service
message()¶
Outputs a message. Delivery semantics differ per implementation: Direct renders and emits immediately, Session stores the raw message for output on a later request.
notice()¶
Shows a HTML notice/information message
outputMessage()¶
Outputs a message formatting it with HTML
setAutoescape()¶
Set the autoescape mode in generated HTML
setAutomaticHtml()¶
Set if the output must be implicitly formatted with HTML
setCssClasses()¶
Set an array with CSS classes to format the messages
setCssIconClasses()¶
Set an array with CSS classes to format the icon messages
setCustomTemplate()¶
Set a custom template for showing the messages
setEscaperService()¶
Sets the Escaper Service
setImplicitFlush()¶
Set whether the output must be implicitly flushed to the output or returned as string
Note: output() is an echo API and requires implicit flush to remain enabled (the default). With implicit flush disabled, message() returns the rendered string while output() does not emit it.
success()¶
Shows a HTML success message
warning()¶
Shows a HTML warning message
Flash\Direct¶
Class Source on GitHub
Class Direct
@package Phalcon\Flash
stdClassPhalcon\Di\AbstractInjectionAwarePhalcon\Flash\AbstractFlashPhalcon\Flash\Direct
Method Summary¶
public string|null message(string $type,mixed $message) Outputs a message public void output( bool $remove = true ) Prints the messages accumulated in the flasher Methods¶
message()¶
Outputs a message
output()¶
Prints the messages accumulated in the flasher
Flash\Exception¶
Class Source on GitHub
Exceptions thrown in Phalcon\Flash classes will use this class
Flash\Exceptions\EscaperServiceUnavailable¶
Class Source on GitHub
\ExceptionPhalcon\Flash\ExceptionPhalcon\Flash\Exceptions\EscaperServiceUnavailable
Uses Phalcon\Flash\Exception
Method Summary¶
Methods¶
__construct()¶
Flash\Exceptions\FlashMessageNotStringOrArray¶
Class Source on GitHub
\ExceptionPhalcon\Flash\ExceptionPhalcon\Flash\Exceptions\FlashMessageNotStringOrArray
Uses Phalcon\Flash\Exception
Method Summary¶
Methods¶
__construct()¶
Flash\Exceptions\SessionServiceUnavailable¶
Class Source on GitHub
\ExceptionPhalcon\Flash\ExceptionPhalcon\Flash\Exceptions\SessionServiceUnavailable
Uses Phalcon\Flash\Exception
Method Summary¶
Methods¶
__construct()¶
Flash\FlashInterface¶
Interface Source on GitHub
Interface FlashInterface
Phalcon\Contracts\Flash\FlashPhalcon\Flash\FlashInterface
Uses Phalcon\Contracts\Flash\Flash
Flash\Session¶
Class Source on GitHub
This is an implementation of the Phalcon\Flash\FlashInterface that temporarily stores the messages in session, then messages can be printed in the next request.
Class Session
@package Phalcon\Flash
stdClassPhalcon\Di\AbstractInjectionAwarePhalcon\Flash\AbstractFlashPhalcon\Flash\Session
Uses Phalcon\Flash\Exceptions\SessionServiceUnavailable · Phalcon\Html\Escaper\EscaperInterface · Phalcon\Session\ManagerInterface
Method Summary¶
public __construct(EscaperInterface $escaper = null,ManagerInterface $session = null,string $sessionKey = null) Session constructor. public void clear() Clear messages in the session messenger public array getMessages(mixed $type = null,bool $remove = true) Returns the messages in the session flasher public ManagerInterface getSessionService() Returns the Session Service public bool has( string $type = null ) Checks whether there are messages public string|null message(string $type,mixed $message) Adds a message to the session flasher public void output( bool $remove = true ) Prints the messages in the session flasher protected array getSessionMessages(bool $remove,string $type = null) Returns the messages stored in session protected array setSessionMessages( array $messages ) Stores the messages in session Constants¶
string SESSION_KEY = "_flashMessages" Properties¶
protected string $sessionKey = "" Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper = null,
ManagerInterface $session = null,
string $sessionKey = null
);
Session constructor.
clear()¶
Clear messages in the session messenger
getMessages()¶
Returns the messages in the session flasher
getSessionService()¶
Returns the Session Service
has()¶
Checks whether there are messages
message()¶
Adds a message to the session flasher
output()¶
Prints the messages in the session flasher
getSessionMessages()¶
Returns the messages stored in session
setSessionMessages()¶
Stores the messages in session