jlaso / jsoneditor-bundle
Symfony JlasoJsonBundle
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Type:symfony-bundle
Requires
- php: >=5.3.2
- symfony/framework-bundle: >=2.1,<2.3-dev
- symfony/security-bundle: >=2.1,<2.3-dev
This package is auto-updated.
Last update: 2024-10-15 10:16:26 UTC
README
Integration json editor in SF2 projects
Instalation
Composer
instantiate Bundle in your kernel init file
// app/AppKernel.php <?php // ... public function registerBundles() { $bundles = array( // ... new Jlaso\Bundle\JlasoJsonEditorBundle\JlasoJsoneditorBundle(), ); }
after, run the command
php app/console assets:install web/
to copy the resources to the projects web directory.
Others
Base configuration
By default, do the following:
Add class "jsoneditor" to textarea field to initialize Htmleditor.
<textarea class="jsoneditor"></textarea>
If you want to use jQuery version of the editor set the following parameters:
jlaso_jsoneditor: include_jquery: true htmleditor_jquery: true ...
The option include_jquery
allow to load external jQuery library from the Google CDN. Set it to true
if you haven't included jQuery library somewhere yet
If you are using FormBuilder, use an array to add the class, you can also use the theme
option to change the
used theme to something other than 'simple' (i.e. on of the other defined themes in your config - the example above
defined 'medium'). e.g.:
<?php $builder->add('introtext', 'textarea', array( 'attr' => array( 'class' => 'jsoneditor', ) ));
Add script to your templates/layout at the bottom of your page (for faster page display).
{{ jsoneditor_init() }}
# app/config/config.yml
twig:
form:
resources:
- 'JlasoJsoneditorBundle:Form:fields.html.twig'
Localization
You can change language of your tiny_mce by adding language selector into top level of configuration, something like
// app/config/config.yml jlaso_jsoneditor: include_jquery: true jsoneditor_jquery: true textarea_class: "jsoneditor" language: %locale% theme: simple: mode: "textareas" theme: "advanced" ...