Skip to content

Instantly share code, notes, and snippets.

@RobinDev
Last active March 14, 2019 12:09
Show Gist options
  • Save RobinDev/c81d6fe3f859c21865c7e100cca9e654 to your computer and use it in GitHub Desktop.
Save RobinDev/c81d6fe3f859c21865c7e100cca9e654 to your computer and use it in GitHub Desktop.
Install CKE editor for PiedWeb CMS

Create a new admin extending and overriding the default one. https://github.com/PiedWeb/CMS/blob/master/src/Admin/PageAdmin.php

$formMapper->add('mainContent', CKEditorType::class

Change the service with your new page admin class :

    piedweb.admin.page:
        class: App\Admin\PageAdmin
        arguments: [~, '%app.entity_page%', ~]
        tags:
            - { name: sonata.admin, manager_type: orm, label: admin.label.page }
        calls:
            - [ setFeedDumper, [ '@piedweb.feed.dumper' ] ]
            - [ setLiipImage, [ '@liip_imagine.cache.manager' ] ]
            - [ setTemplate, [list, '@@PiedWebCMS/admin/media_mosaic.html.twig']]
            - [ setTemplate, [outer_list_rows_mosaic, '@@PiedWebCMS/admin/media_mosaic_body.html.twig']]
        public: true

Install fos cke bundle https://github.com/FriendsOfSymfony/FOSCKEditorBundle

composer require friendsofsymfony/ckeditor-bundle

Update your configuration for ckeditor

twig:
    form_themes:
        - '@FOSCKEditor/Form/ckeditor_widget.html.twig'

fos_ck_editor:
    configs:
        my_config_1:
            toolbar: "my_toolbar_1"
    toolbars:
        configs:
                my_toolbar_1: [  ["Format", "Bold", "Italic", "RemoveFormat", "-", "BulletedList", "Blockquote", "-", "@basic.links", "-", "Source", "-",  "Maximize" , "Save" ] ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment