Quickstart
This simple visual addon help to display and translate flash messages., (*1)
Requirements
Installation
The best way is by Composer:, (*2)
$ composer require rocketmedia-cz/flashmessages:dev-master
Or you can simple download package and place it to vendor/others folder., (*3)
and you must enable addon through your cofing.neon, just put these lines into it, (*4)
services:
flashmessages:
implement: Scribe\Addons\FlashMessages\IFlashMessagesControlFactory
parameters: [templateFile, translator]
arguments: [%templateFile%, %translator%]
or if you won't change template file or use translator with magic function throught interface, you can use shorted version, (*5)
services:
flashmessages: Scribe\Addons\FlashMessages\IFlashMessagesControlFactory
Setup
In presenter we can use @inject annotation from Nette version 2.1 -, (*6)
/** @var \Scribe\Addons\FlashMessages\IFlashMessagesControlFactory @inject */
public $flashMessagesControl;
/**
* @return \Scribe\Addons\FlashMessages\FlashMessagesControl
*/
protected function createComponentFlashMessages()
{
return $this->flashMessagesControl->create();
}
If we want to change template file or translate our messages, we have to change parameters in create() function., (*7)
return $this->flashMessagesControl->create('newTemplateFile.latte', $ourTranslator);
Usage
Just initialize component in template and it is., (*8)
{control flashMessages}
Default template is in snippet, so you can redraw snippet with flash messages, (*9)
$this->redrawControl('flashMessages');
Created by David Zadražil for [Rocketmedia.cz][3]., (*10)