Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.1 KB

usage.md

File metadata and controls

50 lines (37 loc) · 1.1 KB

Using the Editor Bundle

Form elements

A form element with class='tinymce' will automatically be converted to use the TinyMCE editor.

# src/form/Something.php

        $builder->add('description', TextareaType::class, [
            'label' => 'Description',
            'required' => true,
            'attr' => [
                'class' => 'tinymce',
            ],
        ]);

You can add the editor selectively when a form requires it, or globally so that it is available everywhere.

Selective Usage

Pages with forms that use the TinyMCE editor can include the Javascript library with the twig block system.

{# templates/entity/edit.html.twig #}

    {% block javascripts %}
    {% include '@NinesEditor/editor/widget.html.twig' %}
    {% endblock %}

Global Usage

Add the widget template in the base template to make it available everywhere. This may be undesirable, as it will be available even on pages that do not need it.

{# templates/base.html.twig #}

    {% include '@NinesEditor/editor/widget.html.twig' %}