ProjectLightBundle
Adds the University of Cambridge's house style to your Symfony2 application., (*1)
Authors
Installation
-
Add the ProjectLightBundle to your dependencies:, (*2)
// composer.json
{
// ...
"require": {
// ...
"misd/project-light-bundle": "~1.0@dev"
}
}
-
Use Composer to download and install the ProjectLightBundle:, (*3)
$ php composer.phar update misd/project-light-bundle
-
Register the bundle in your application:, (*4)
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Misd\ProjectLightBundle\ProjectLightBundle()
);
}
Project Light assets
The bundle contains all of the Project Light assets (stylesheet, JavaScript and images)., (*5)
Base template
Either extend the base template:, (*6)
{% extends 'ProjectLightBundle::base.html.twig' %}
Or one of the themes:, (*7)
{% extends 'ProjectLightBundle::theme_blue.html.twig' %}
{% extends 'ProjectLightBundle::theme_green.html.twig' %}
{% extends 'ProjectLightBundle::theme_grey.html.twig' %}
{% extends 'ProjectLightBundle::theme_orange.html.twig' %}
{% extends 'ProjectLightBundle::theme_purple.html.twig' %}
{% extends 'ProjectLightBundle::theme_red.html.twig' %}
{% extends 'ProjectLightBundle::theme_turquoise.html.twig' %}
title
The HTML <title>
can be set in the title
block. This is blank by default., (*8)
Example:, (*9)
{% block title %}My title{% endblock %}
stylesheets
Local stylesheets can be included in the stylesheets
block., (*10)
Example:, (*11)
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('path/to/my/stylesheet.css') }}">
{% endblock %}
theme
If not extending one of the specific theme templates, you can set it in the theme
block., (*12)
Example:, (*13)
{% block theme %}campl-theme-3{% endblock %}
content
This contains all content (including the local header)., (*14)
A local footer can be included in the footer
block., (*15)
javascripts
Local JavaScript files can be included in the javascripts
block. This appear at the end of the page (ie before the </body>
)., (*16)
Example:, (*17)
{% block javascripts %}
<script src="{{ asset('path/to/my/javascript.css' }}"></script>
{% endblock %}
partnerships
Partnership branding can be included in the partnerships
block., (*18)
Example:, (*19)
{% block partnerships %}
<div class="campl-row campl-content">
<div class="campl-wrap clearfix">
<div class="campl-column12 campl-partnership-branding">
<div class="campl-content-container campl-side-padding">
<div class="campl-content-container campl-logo-container campl-bottom-padding">
<p class="campl-branding-title">Supported by</p>
<ul class="campl-unstyled-list campl-logo-list campl-horizontal-navigation clearfix">
<li><img src="{{ asset('path/to/the/logo.png') }}" alt="Some Company"/></li>
</ul>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
Notifications
The bundle comes with a template for notifications, which you can use like:, (*20)
{% for level, messages in app.session.flashbag.all() %}
{% for message in messages %}
{% include 'ProjectLightBundle:Component:notification.html.twig' with {level: level, text: message} %}
{% endfor %}
{% endfor %}
Expected levels are success
, warning
, alert
and information
(default)., (*21)
The bundle comes with a custom menu renderer which replaces the default. If you want to use your own renderer, you can configure the KnpMenuBundle as normal., (*22)
The bundle comes with a custom view which replaces the default. If you want to use your own view, you can configure the WhiteOctoberPagerfantaBundle as normal., (*23)