WysiwygType::getParent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file was created by developers working at BitBag
5
 * Do you need more information about us and what we do? Visit our https://bitbag.io website!
6
 * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7
*/
8
9
declare(strict_types=1);
10
11
namespace BitBag\SyliusCmsPlugin\Form\Type;
12
13
use FOS\CKEditorBundle\Form\Type\CKEditorType;
14
use Symfony\Component\Form\AbstractType;
15
use Symfony\Component\OptionsResolver\OptionsResolver;
16
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
17
18
final class WysiwygType extends AbstractType
19
{
20
    /** @var UrlGeneratorInterface */
21
    private $urlGenerator;
22
23
    public function __construct(UrlGeneratorInterface $urlGenerator)
24
    {
25
        $this->urlGenerator = $urlGenerator;
26
    }
27
28
    public function configureOptions(OptionsResolver $resolver): void
29
    {
30
        $resolver->setDefaults([
31
            'label' => 'bitbag_sylius_cms_plugin.ui.content',
32
            'config' => [
33
                'filebrowserUploadUrl' => $this->urlGenerator->generate('bitbag_sylius_cms_plugin_admin_upload_editor_image'),
34
                'bodyId' => 'bitbag-ckeditor',
35
            ],
36
        ]);
37
    }
38
39
    public function getParent(): string
40
    {
41
        return CKEditorType::class;
42
    }
43
44
    public function getBlockPrefix(): string
45
    {
46
        return 'bitbag_wysiwyg';
47
    }
48
}
49