Other Editors

1.3 version
Maintained Unmaintained

Other Editors

You can use the lightweight hallo.js editor with CreateBundle or write your own template to load a different editor or customize one of the existing editors is configured.

Note

To focus our efforts onto a manageable number of packages, this package is currently not maintained. Security fixes and submitted bug fixes will still be released, but no new features should be expected. This bundle might have outdated documentation, there is no support from the CMF team and you should not expect bugs to be fixed.

If you want to help co-maintaining this package, tell us in a GitHub issue or in #symfony_cmf of the Symfony devs slack.

Using Hallo.js Editor

If you want to use the hallo.js editor instead of CKEditor, you should configure the downloadCreate instead of downloadCreateAndCkeditor composer script handler. The files for hallo.js are already included in the create.js distribution:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
    "scripts": {
        "post-install-cmd": [
            "Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreate",
            ...
        ],
        "post-update-cmd": [
            "Symfony\\Cmf\\Bundle\\CreateBundle\\Composer\\ScriptHandler::downloadCreate",
            ...
        ]
    }
}

Then re-run composer:

1
$ composer run-scripts

In your template, load the JavaScript files using:

  • Twig
    1
    {% render(controller("cmf_create.jsloader.controller:includeJSFilesAction")) %}
    
  • PHP
    1
    2
    3
    4
    5
    6
    <?php $view['actions']->render(
        'cmf_create.jsloader.controller:includeJSFilesAction',
        array(
            'editor' => 'hallo',
        )
    ) ?>
    

If you want to use the image plugin of hallo, you also need to register the additional image controller routing file in your main routing configuration:

  • YAML
    1
    2
    create_image:
        resource: "@CmfCreateBundle/Resources/config/routing/image.xml"
    
  • XML
    1
    <import resource="@CmfCreateBundle/Resources/config/routing/image.xml" />
    
  • PHP
    1
    2
    3
    4
    5
    6
    use Symfony\Component\Routing\RouteCollection;
    
    $collection = new RouteCollection();
    $collection->addCollection($loader->import("@CmfCreateBundle/Resources/config/routing/image.xml"));
    
    return $collection;
    

Custom Editors

You can provide your own template to customize how to load CKEditor, hallo.js or a WYSIWYG editor not supported out of the box. The template has follow the naming pattern CmfCreateBundle::includejsfiles-%editor%.html.twig to be loaded. You custom file thus needs to reside in app/Resources/CmfCreateBundle/views/ and has to be called includejsfiles-myeditor.html.twig where myeditor is the name you want to use in the action. In the includeJSFilesAction, you specify the editor parameter:

  • Twig
    1
    2
    3
    4
    {% render(controller(
            "cmf_create.jsloader.controller:includeJSFilesAction",
             {'editor': 'myeditor' }
    )) %}
    
  • PHP
    1
    2
    3
    4
    5
    <?php $view['actions']->render(
        new ControllerReference('cmf_create.jsloader.controller:includeJSFilesAction', array(
            'editor'  => 'myeditor',
        ))
    ); ?>
    

Note

Create.js has built in support for the Aloha editor as well. We hope to provide out of the box support for Aloha in this bundle too. If you want to help, please see the github issue for aloha integration.

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