Manage CKEditor loading
Manage CKEditor loading¶
By default, in order to prototype your form really fast, the bundle loads the CKEditor library each time you declare a CKEditor form. Basically, it means that if you have three CKEditor fields in your form, then, there will be three CKEditor library loadings.
Load CKEditor manually¶
If you want to control the CKEditor loading, you can configure the bundle to not load the library at all and let you the control of it. To disable the CKEditor library loading, you can do it globally in your configuration:
1 2 3
# app/config/config.yml fos_ck_editor: autoload: false
Or you can disable it in your widget:
$builder->add('field', 'ckeditor', array('autoload' => false));
If you use this approach, be aware CKEditor must be loaded before any fields
have been rendered, so we recommend you to register it in the
Load CKEditor asynchronously¶
So, first you need configure the bundle. You can do it globally in your configuration:
1 2 3 4
# app/config/config.yml fos_ck_editor: autoload: false async: true
Or you can configure it in your widget:
1 2 3 4
$builder->add('field', 'ckeditor', array( 'autoload' => false, 'async' => true, ));
Then, install the third party bundles as explained in its documentation.
Or if you use the PHP templating engine:
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.