Skip to content
  • About
    • What is Symfony?
    • Community
    • News
    • Contributing
    • Support
  • Documentation
    • Symfony Docs
    • Symfony Book
    • Screencasts
    • Symfony Bundles
    • Symfony Cloud
    • Training
  • Services
    • Platform.sh for Symfony Best platform to deploy Symfony apps
    • SymfonyInsight Automatic quality checks for your apps
    • Symfony Certification Prove your knowledge and boost your career
    • SensioLabs Professional services to help you with Symfony
    • Blackfire Profile and monitor performance of your apps
  • Other
  • Blog
  • Download
sponsored by
  1. Home
  2. Documentation
  3. Bundles
  4. FOSCKEditorBundle
  5. Define reusable configuration

Define reusable configuration

Edit this page

The CKEditor bundle provides an advanced configuration which can be reused on multiple CKEditor instances. Instead of duplicate the configuration on each form builder, you can directly configure it once and reuse it all the time. The bundle allows you to define as many configurations as you want.

Tip

Check out the full list of CKEditor configuration options.

Define a configuration

1
2
3
4
5
6
7
8
9
# app/config/config.yml
fos_ck_editor:
    configs:
        my_config:
            toolbar: [ ["Source", "-", "Save"], "/", ["Anchor"], "/", ["Maximize"] ]
            uiColor:                "#000000"
            filebrowserUploadRoute: "my_route"
            extraPlugins:           "wordcount"
            # ...

Tip

The config node is a variable node meaning you can put any CKEditor configuration options in it.

Note

The first configuration defined will be used as default configuration if you don't explicitly configure it.

Use a configuration

When you have defined a config, you can use it with the config_name option:

1
2
3
$builder->add('field', 'ckeditor', array(
    'config_name' => 'my_config',
));

Override a configuration

If you want to override some parts of the defined config, you can still use the config option:

1
2
3
4
$builder->add('field', 'ckeditor', array(
    'config_name' => 'my_config',
    'config'      => array('uiColor' => '#ffffff'),
));

Define default configuration

If you want to define your configuration globally to use it by default without having to use the config_name option, you can use the default_config node:

1
2
3
4
5
6
# app/config/config.yml
fos_ck_editor:
    default_config: my_config
    configs:
        my_config:
            # ...
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version
    Peruse our complete Symfony & PHP solutions catalog for your web development needs.

    Peruse our complete Symfony & PHP solutions catalog for your web development needs.

    Save your teams and projects before they sink

    Save your teams and projects before they sink

    Version:

    Table of Contents

    • Define a configuration
    • Use a configuration
    • Override a configuration
    • Define default configuration

    Symfony footer

    Avatar of Robin Lehrmann, a Symfony contributor

    Thanks Robin Lehrmann for being a Symfony contributor

    2 commits • 103 lines changed

    View all contributors that help us make Symfony

    Become a Symfony contributor

    Be an active part of the community and contribute ideas, code and bug fixes. Both experts and newcomers are welcome.

    Learn how to contribute

    Symfony™ is a trademark of Symfony SAS. All rights reserved.

    • What is Symfony?

      • What is Symfony?
      • Symfony at a Glance
      • Symfony Components
      • Symfony Releases
      • Security Policy
      • Logo & Screenshots
      • Trademark & Licenses
      • symfony1 Legacy
    • Learn Symfony

      • Symfony Docs
      • Symfony Book
      • Reference
      • Bundles
      • Best Practices
      • Training
      • eLearning Platform
      • Certification
    • Screencasts

      • Learn Symfony
      • Learn PHP
      • Learn JavaScript
      • Learn Drupal
      • Learn RESTful APIs
    • Community

      • Symfony Community
      • SymfonyConnect
      • Events & Meetups
      • Projects using Symfony
      • Contributors
      • Symfony Jobs
      • Backers
      • Code of Conduct
      • Downloads Stats
      • Support
    • Blog

      • All Blog Posts
      • A Week of Symfony
      • Case Studies
      • Cloud
      • Community
      • Conferences
      • Diversity
      • Living on the edge
      • Releases
      • Security Advisories
      • Symfony Insight
      • Twig
      • SensioLabs Blog
    • Services

      • SensioLabs services
      • Train developers
      • Manage your project quality
      • Improve your project performance
      • Host Symfony projects

      Powered by

    Follow Symfony