NoticeManagerBundle
, (*1)
Notice manager Symfony2 bundle, (*2)
Installation
Step 1: Download NoticeManagerBundle using composer
Add TadckaNoticeBundle in your composer.json:, (*3)
{
"require": {
"tadcka/notice-manager-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command:, (*4)
``` bash
$ php composer.phar update tadcka/notice-manager-bundle, (*5)
### Step 2: Enable the bundle
Enable the bundle in the kernel:
``` php
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Tadcka\AddressBundle\TadckaNoticeManagerBundle(),
);
}
Step 3: Include javascript and css
@TadckaNoticeManagerBundle/Resources/public/css/notice-manager.css
@TadckaNoticeManagerBundle/Resources/public/js/notice-manager.js
Step 4: Include twig template
{% include 'TadckaNoticeManagerBundle::flash_notices.html.twig' %}
Step 5: Example
``` php
$noticeContainer = new \Tadcka\NoticeManagerBundle\Container\NoticeContainer();
$noticeContainer->add('Hello world!', \Tadcka\NoticeManagerBundle\NoticeType::SUCCESS);
$this->get('tadcka_notice_manager')->save($noticeContainer);, (*6)
or, (*7)
$noticeContainer = new \Tadcka\NoticeManagerBundle\Container\NoticeContainer();
$noticeContainer->add('Hello world!', \Tadcka\NoticeManagerBundle\NoticeType::SUCCESS);
$html = $this->renderView(
'TadckaNoticeManagerBundle::notices.html.twig',
array(
'notice_container' => $noticeContainer->getNotices(),
)
);
```, (*8)