Completed
Push — master ( 52c5e3...8008ee )
by
unknown
15s queued 12s
created

EditInProductionWarning   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 26
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 17 2
1
<?php
2
3
/**
4
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
5
 *
6
 * This file is part of the Kitodo and TYPO3 projects.
7
 *
8
 * @license GNU General Public License version 3 or later.
9
 * For the full copyright and license information, please read the
10
 * LICENSE.txt file that was distributed with this source code.
11
 */
12
13
namespace Kitodo\Dlf\Hooks\Form\FieldInformation;
14
15
use Kitodo\Dlf\Common\Helper;
16
use TYPO3\CMS\Backend\Form\AbstractNode;
0 ignored issues
show
Bug introduced by
The type TYPO3\CMS\Backend\Form\AbstractNode was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
18
/**
19
 * FieldInformation renderType for TYPO3 FormEngine
20
 *
21
 * @author Sebastian Meyer <[email protected]>
22
 * @package TYPO3
23
 * @subpackage dlf
24
 * @access public
25
 */
26
class EditInProductionWarning extends AbstractNode
27
{
28
    /**
29
     * Generates warning message when editing 'index_name' field
30
     *
31
     * @access public
32
     *
33
     * @return array As defined in initializeResultArray() of AbstractNode
34
     */
35
    public function render(): array
36
    {
37
        $result = $this->initializeResultArray();
38
        // Show warning only when editing existing records.
39
        if ($this->data['command'] !== 'new') {
40
            // Load localization file.
41
            $GLOBALS['LANG']->includeLLFile('EXT:dlf/Resources/Private/Language/FlashMessages.xml');
42
            // Create flash message.
43
            Helper::addMessage(
44
                htmlspecialchars($GLOBALS['LANG']->getLL('flash.editInProductionWarning')),
45
                '', // We must not set a title/header, because <h4> isn't allowed in FieldInformation.
46
                \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING
47
            );
48
            // Add message to result array.
49
            $result['html'] = Helper::renderFlashMessages();
50
        }
51
        return $result;
52
    }
53
}
54