djaney/theming-bundle

There is no license information available for the latest version (dev-master) of this package.

A service to that lets you choose the theme bundle to use

Installs: 230

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

dev-master 2016-06-10 08:21 UTC

This package is not auto-updated.

Last update: 2024-09-23 11:15:49 UTC


README

Creates a simple theming using a Child Theme and a Base Theme.

If the template name exists in the child, the child bundle template is used.

Else, The base theme will be used.

The Base theme is set in the service.yml while the Child is passed during the service call.

src
|-BaseThemeBundle/Resources/views/**.html.twig
|-ChildThemeBundle/Resources/views/**.html.twig

A Theme is simply a bundle with views.

Installation

In composer.json

"require": {
    "djaney/theming-bundle": "dev-master"
}

Usage

Register the service

Second argument is the name of the base theme

services:
    theme:
        class: Djaney\ThemingBundle\ThemeSelector\ThemeSelectorService
        arguments: [ "@twig" , BaseThemeBundle ]

Use in Controller

second argument is the theme name. Set as NULL to use base theme.

return $this->get('theme')->template('Default/index.html.twig', 'ChildThemeBundle', $data);