2017 © Pedro Peláez
 

symfony-bundle jsoneditor-bundle

Symfony JlasoJsonBundle

image

jlaso/jsoneditor-bundle

Symfony JlasoJsonBundle

  • Tuesday, March 26, 2013
  • by jlaso
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

JlasoJsoneditorBundle

Integration json editor in SF2 projects, (*1)

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, (*2)

    php app/console assets:install web/

to copy the resources to the projects web directory., (*3)

Others


Base configuration

By default, do the following:, (*4)

Add class "jsoneditor" to textarea field to initialize Htmleditor., (*5)

    <textarea class="jsoneditor"></textarea>

If you want to use jQuery version of the editor set the following parameters:, (*6)

    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, (*7)

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.:, (*8)

<?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)., (*9)


{{ 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, (*10)

    // app/config/config.yml
    jlaso_jsoneditor:
        include_jquery: true
        jsoneditor_jquery: true
        textarea_class: "jsoneditor"
        language: %locale%
        theme:
            simple:
                mode: "textareas"
                theme: "advanced"
        ...

The Versions

26/03 2013

dev-master

9999999-dev http://github.com/jlaso

Symfony JlasoJsonBundle

  Sources   Download

MIT

The Requires

 

json editor