Passed
Push — master ( cf28ed...fb61c9 )
by Romain
07:26 queued 04:29
created

MissingCkEditorPreset   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 8 1
1
<?php
2
3
/*
4
 * Copyright (C) 2018
5
 * Nathan Boiron <[email protected]>
6
 * Romain Canon <[email protected]>
7
 *
8
 * This file is part of the TYPO3 NotiZ project.
9
 * It is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU General Public License, either
11
 * version 3 of the License, or any later version.
12
 *
13
 * For the full copyright and license information, see:
14
 * http://www.gnu.org/licenses/gpl-3.0.html
15
 */
16
17
namespace CuyZ\Notiz\Core\Notification\TCA\User;
18
19
use CuyZ\Notiz\Service\LocalizationService;
20
use CuyZ\Notiz\Service\StringService;
21
use TYPO3\CMS\Core\SingletonInterface;
22
23
class MissingCkEditorPreset implements SingletonInterface
24
{
25
    /**
26
     * If a RTE is using a missing CKEditor preset, a message is shown to the
27
     * user to help him fix it.
28
     *
29
     * @param array $parent
30
     * @return string
31
     */
32
    public function process(array $parent)
33
    {
34
        $preset = $parent['parameters']['preset'];
35
36
        $message = LocalizationService::localize('Notification/Entity:field.rte.ck_editor_preset_missing', [$preset]);
37
        $message = StringService::mark($message, '<code>$1</code>');
38
39
        return '<span class="bg-danger">' . $message . '</span>';
40
    }
41
}
42