-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate CKEditor #3647
Comments
Yo !
public function configureCrud(Crud $crud): Crud
{
$crud->setFormThemes(['@FOSCKEditor/Form/ckeditor_widget.html.twig', '@EasyAdmin/crud/form_theme.html.twig']);
return $crud;
} (don't forget to use the EA form theme too like I did)
namespace App\Admin\Field;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
final class CKEditorField implements FieldInterface
{
use FieldTrait;
/**
* @param string|false|null $label
*/
public static function new(string $propertyName, $label = null): self
{
return (new self())
->setProperty($propertyName)
->setLabel($label)
// this template is used in 'index' and 'detail' pages
->setTemplateName('crud/field/text_editor')
// this is used in 'edit' and 'new' pages to edit the field contents
// you can use your own form types too
->setFormType(CKEditorType::class)
->addCssClass('field-ckeditor');
}
} annnnnnd... everything should work if you use the newly created Field type like this : public function configureFields(string $pageName): iterable
{
return [
TextField::new('title'),
CKEditorField::new('htmlContent'),
];
} (this example doesn't use Webpack Encore at all, cause EA doesn't use it natively) |
Thank you so much for posting this solution - it works 100% with the current version of Symfony 6.2.x |
Thank you again. Very usefully. |
it's not working with symfony 6.4 and easy admin 4 |
checkout this: |
Hello,
I'm using EasyAdminBundle version 3 with Symfony 5.1.
I need to create a WYSIWYG field, so I searched in your documentation and I've found the TextEditorField.
This is a kind of WYSIWYG but with less possibilities, I need to have more.
Would it be possible to integrate CKEditor like in version 2 ?
Thanks for answers.
The text was updated successfully, but these errors were encountered: