add specific form types for Tinymce and EditorJS
This commit is contained in:
parent
2ad1d86b76
commit
af68d3d269
24
src/core/Form/Type/EditorJsTextareaType.php
Normal file
24
src/core/Form/Type/EditorJsTextareaType.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Core\Form\Type;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CollectionType as BaseCollectionType;
|
||||||
|
use Symfony\Component\Form\FormInterface;
|
||||||
|
use Symfony\Component\Form\FormView;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
|
|
||||||
|
class EditorJsTextareaType extends TextareaType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||||
|
{
|
||||||
|
if (!isset($view->vars['attr']['data-editorjs'])) {
|
||||||
|
$view->vars['attr']['data-editorjs'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::buildView($view, $form, $options);
|
||||||
|
}
|
||||||
|
}
|
24
src/core/Form/Type/TinymceTextareaType.php
Normal file
24
src/core/Form/Type/TinymceTextareaType.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Core\Form\Type;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CollectionType as BaseCollectionType;
|
||||||
|
use Symfony\Component\Form\FormInterface;
|
||||||
|
use Symfony\Component\Form\FormView;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
|
|
||||||
|
class TinymceTextareaType extends TextareaType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||||
|
{
|
||||||
|
if (!isset($view->vars['attr']['data-tinymce'])) {
|
||||||
|
$view->vars['attr']['data-tinymce'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::buildView($view, $form, $options);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue