Passed
Push — master ( 3d3d69...b10d98 )
by Julito
21:59
created

EditorController::configEditorAction()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 32
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 20
nc 4
nop 2
dl 0
loc 32
rs 9.6
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Controller;
8
9
use Chamilo\CoreBundle\Component\Editor\CkEditor\CkEditor;
10
use Chamilo\CoreBundle\Traits\ControllerTrait;
11
use Chamilo\CoreBundle\Traits\CourseControllerTrait;
12
use Chamilo\CoreBundle\Traits\ResourceControllerTrait;
13
use Symfony\Component\HttpFoundation\Response;
14
use Symfony\Component\Routing\Annotation\Route;
15
use Symfony\Component\Routing\RouterInterface;
16
use Symfony\Contracts\Translation\TranslatorInterface;
17
18
#[Route('/editor')]
19
class EditorController extends BaseController
20
{
21
    use ControllerTrait;
22
    use ResourceControllerTrait;
23
    use CourseControllerTrait;
24
25
    /**
26
     * Get templates (left column when creating a document).
27
     *
28
     * @Route("/templates", methods={"GET"}, name="editor_templates")
29
     *
30
     * @return Response
31
     */
32
    public function editorTemplatesAction(TranslatorInterface $translator, RouterInterface $router)
33
    {
34
        $editor = new CkEditor(
35
            $translator,
36
            $router
37
        );
38
        $templates = $editor->simpleFormatTemplates();
39
40
        return $this->render(
41
            '@ChamiloCore/Editor/templates.html.twig',
42
            [
43
                'templates' => $templates,
44
            ]
45
        );
46
    }
47
}
48