Open 0x48415a484952 opened 4 years ago
Hi, I don't know how you use CKEditor exactly, but in my project I created a CKEditorField
and set the template name to crud/field/text_editor
.
@AhmadzadehHazhir, can you show us your code to help you?
@AhmadzadehHazhir hi, have you found the solution ? because I have the same issue
I have made a custom template for it in templates/bundles/EasyAdminBundle/crud/field/text_editor.html.twig
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
<!-- Own template in templates/bundles/EasyAdminBundle-->
{% if ea.crud.currentAction == 'detail' %}
{{ field.value|raw }}
{% else %}
{% set html_id = 'ea-text-editor-' ~ field.uniqueId %}
<a href="#" data-bs-toggle="modal" data-bs-target="#{{ html_id }}">
<i class="far fa-file-alt"></i> {{ 'field.text_editor.view_content'|trans([], domain = 'EasyAdminBundle') }}
</a>
<div class="modal fade" id="{{ html_id }}" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{ field.label }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="{{ 'action.close'|trans([], domain = 'EasyAdminBundle') }}">
</button>
</div>
<div class="modal-body">
{{ field.formattedValue|nl2br }}
</div>
</div>
</div>
</div>
{% endif %}
is there any configuration to do in the crudcontroller instead ?
You can set a twig template in the crud as well
Op vr 12 nov. 2021 18:37 schreef Anne Gren @.***>:
is there any configuration to do in the crudcontroller instead ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EasyCorp/EasyAdminBundle/issues/3687#issuecomment-967293861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2RBPWYF7YMDAXME7RHGHTULVGBPANCNFSM4QF55CUQ .
Like this:
yield CollectionField::new('insurancePolicies')
->setTemplatePath('customer-policies.html.twig')
->onlyOnDetail();
great many thanks :)
i have used ckeditor in easyAdmin3 now whenever i want to display the content it will display it like below how to solve this issue?