TempoJsConfigurationBundle
This bundle allows you to expose configuration in your JavaScript code., (*1)
Installation
Require tempo/jsconfiguration-bundle
into your composer.json
file:, (*2)
``` json
{
"require": {
"tempo-project/jsconfiguration-bundle": "dev-master"
}
}, (*3)
Register the bundle in `app/AppKernel.php`:
``` php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Tempo\Bundle\JsConfigurationBundle\TempoJsConfigurationBundle(),
);
}
Publish assets:, (*4)
$ php app/console tempo:js-configuration:dump
$ php app/console assets:install --symlink web
Usage
Moreover, you can configure a list of configuration to expose in app/config/config.yml:, (*5)
``` yaml, (*6)
app/config/config.yml
tempo_js_configuration:
config_to_expose: [mopa_bootstrap.form.show_legend], (*7)
Add these two lines in your layout:
```, (*8)
Testing
Setup the test suite using Composer:, (*9)
$ composer install --dev, (*10)
Run it using PHPUnit:, (*11)
$ phpunit, (*12)
Resources