Created
August 29, 2019 15:02
-
-
Save cleggypdc/e07c8314067e48238e191ecaf57ff9b5 to your computer and use it in GitHub Desktop.
Editable CKEDITOR Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Document; | |
final class EditableConstants | |
{ | |
const TITLE_WYSIWYG_CONFIG = [ | |
'placeholder' => 'Section title ...', | |
'enterMode' => 2, | |
"toolbarGroups" => [ | |
[ | |
"name" => 'basicstyles', | |
"groups" => ['basicstyles', 'colors', 'cleanup'] | |
] | |
], | |
'height' => 50 | |
]; | |
const BLOG_WYSIWYG_CONFIG = [ | |
"toolbarGroups" => [ | |
[ 'name' => 'clipboard', 'groups' => [ 'undo', 'clipboard' ] ], | |
[ 'name' => 'editing', 'groups' => [ 'find', 'selection', 'editing' ] ], | |
[ 'name' => 'basicstyles', 'groups' => [ 'basicstyles', 'cleanup' ] ], | |
'/', | |
[ 'name' => 'paragraph', 'groups' => [ 'align', 'list', 'indent', 'blocks', 'paragraph' ] ], | |
[ 'name' => 'links', 'groups' => [ 'links' ] ], | |
[ 'name' => 'insert', 'groups' => [ 'insert' ] ], | |
'/', | |
[ 'name' => 'styles', 'groups' => [ 'styles' ] ], | |
[ 'name' => 'colors', 'groups' => [ 'colors' ] ], | |
[ 'name' => 'document', 'groups' => [ 'mode' ] ] | |
], | |
"removeButtons" => 'Save,NewPage,Preview,Print,Templates,Find,SelectAll,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CopyFormatting,JustifyBlock,Language,BidiRtl,BidiLtr,Flash,Table,Smiley,PageBreak,Iframe,About,Maximize,ShowBlocks,Font,Styles', | |
"disallowedContent" => 'h1' | |
]; | |
const PROFILE_IMAGE_CONFIG = [ | |
'class' => 'img-fluid rounded-circle', | |
'disableInlineUpload' => true, | |
'width' => 56, | |
'height' => 56, | |
'thumbnail' => 'profile-image' | |
]; | |
/** | |
* Extend a constant array with custom config, basically an array_merge but explains why | |
* @param array $constant | |
* @param array $newConfig | |
* @return array | |
*/ | |
public static function extend($constant=[], $newConfig=[]) | |
{ | |
return array_merge($constant, $newConfig); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
<?= $this->wysiwyg('content', \AppBundle\Document\EditableConstants::BLOG_WYSIWYG_CONFIG); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this PHP class for using the class
EditableConstants
with Twig:Usage:
(Don't forgot to register it within
templating_twig.yml
)