- Add this bundle to your project:
[BootstrapBundle]
git=http://github.com/yoye/BootstrapBundle.git
target=/bundles/Yoye/Bundle/BootstrapBundle
- Add namespace
<?php
// app/autoload.php
$loader->registerNamespaces(array(
// ...
'Yoye' => __DIR__.'/../vendor/bundles',
));
- Register this bundle
// application/ApplicationKernel.php
public function registerBundles()
{
return array(
// ...
new Yoye\Bundle\BootstrapBundle\YoyeBootstrapBundle(),
// ...
);
}
- Alert
You can use alert as macro in your template.
{% import "YoyeBootstrapBundle::alert.html.twig" as alert %}
{{ alert.show('basic') }}
In your controller set your flash message.
<?php
$this->get('session')->setFlash('warning', 'Type your warning message !');
$this->get('session')->setFlash('info', 'Type your info message !');
$this->get('session')->setFlash('success', 'Type your success message !');
$this->get('session')->setFlash('error', 'Type your error message !');
- Form
Config your form template:
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
form:
resources:
- 'YoyeBootstrapBundle:Form:fields.html.twig'
- Breadcrumb
You can use breadcrumb as macro in your template.
{% import "YoyeBootstrapBundle::breadcrumb.html.twig" as breadcrumb %}
{{ breadcrumb.draw({
'homepage' : path("homepage"),
'You are here !' : none}) }}