FriendsOfSymfony / FOSCKEditorBundle

Provides a CKEditor integration for your Symfony project.
Other
522 stars 84 forks source link

Impossible to customize Toolbar #207

Open kendyan opened 4 years ago

kendyan commented 4 years ago

Symfony packages

"php": "^7.1.3", "ext-ctype": "*", "ext-iconv": "*", "friendsofsymfony/ckeditor-bundle": "^2.1", "sensio/framework-extra-bundle": "^5.1","symfony/asset": "4.4.*", "symfony/console": "4.4.*", "symfony/dotenv": "4.4.*", "symfony/expression-language": "4.4.*", "symfony/flex": "^1.3.1", "symfony/form": "4.4.*", "symfony/framework-bundle": "4.4.*", "symfony/http-client": "4.4.*", "symfony/intl": "4.4.*", "symfony/mailer": "4.4.*", "symfony/monolog-bundle": "^3.1", "symfony/orm-pack": "*", "symfony/process": "4.4.*", "symfony/security-bundle": "4.4.*", "symfony/serializer-pack": "*", "symfony/translation": "4.4.*", "symfony/twig-pack": "*", "symfony/validator": "4.4.*", "symfony/web-link": "4.4.*", "symfony/webpack-encore-bundle": "^1.7", "symfony/yaml": "4.4.*"

Subject

Impossible to customize the toolbar

Here my fos_ckeditor.yaml

fos_ck_editor: configs: my_config_1: toolbar: "my_toolbar_1" uiColor: "#e2e2e2" toolbars: configs: my_toolbar_1: [ "@document", "/", "@link" ] items: document: ["Source", "-", "Save"] links: ["Link", "-", "Unlink"] Capture d’écran 2019-12-17 à 08 22 31

Actual results

Undefined index my_toolbar_1 Capture d’écran 2019-12-17 à 08 21 42

proArtex commented 4 years ago

It is a bug actually. I solved this by specifying a toolbar under form's type_options.config.toolbar. Not a clean solution though, since the rest of my config is in fos_ck_editor.yaml.

m-ar-c commented 2 years ago

I'm bitten by the exact same bug too.

@proArtex , any chance you can elaborate on what you did please ?

m-ar-c commented 2 years ago

Well, this is not a bug, it's just us being too dumb or not awaken enough...

Here's what works :

$builder->add('description', CKEditorType::class,
              ['config' => ['toolbar' => 'my_custom_toolbar'] ]);
fos_ck_editor:
    default_config: default

    configs:

        default:
            toolbar:
            # whatever here

    toolbars:
      configs:
        my_custom_toolbar: [
        '@standard.clipboard',
        '@standard.editing',
        ['Table', 'HorizontalRule', 'SpecialChar'],
        '@standard.tools',
        '@standard.document',
        '@standard.basic_styles',
        '@standard.paragraph',
        '@standard.about',
        ]

So the toolbars node must not be under configs, but at the same level.

Almost three year later, we can now close this "bug" I think... 🙂

josephzhao commented 9 months ago

$formMapper ->with('Login Page Messages', array('class' => 'col-md-6')) ->add('title') ->add('enabled', null, array('label' => '')) ->add('message', CKEditorType::class, ['label' => 'Message Content', 'config' => ['toolbar' => 'my_custom_toolbar'], "attr" => ["style" => "width:100%;height:250px"]])

I am not able to make it works, no toolbar displayed

Thank you very much