English spoken conference

Symfony 5: The Fast Track

A new book to learn about developing modern Symfony 5 applications.

Support this project

RequireJS Support

RequireJS Support

If your application relies on RequireJS, we recommend you to enable its support. The bundle will automatically wrap the CKEditor instantiation into a require block making the code more reliable.

Configure RequireJS

The first step is to configure RequireJS in order to make it aware of where CKEditor is located. For that, you can use the following snippet:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
    paths: {
        'ckeditor': '{{ asset("bundles/fosckeditor/ckeditor") }}'
    },
    shim: {
        'ckeditor': {
            deps: ['jQuery'],
            exports: 'CKEDITOR'
        }
    }
}

Enable RequireJS

The second step is to enable RequireJS in the bundle. To do so, you can configure it globally in you configuration:

1
2
3
# app/config/config.yml
fos_ck_editor:
    require_js: true

Or you can configure it in your widget:

1
$builder->add('field', 'ckeditor', array('require_js' => true));

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.