|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* Copyright (C) |
|
6
|
|
|
* Nathan Boiron <[email protected]> |
|
7
|
|
|
* Romain Canon <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* This file is part of the TYPO3 NotiZ project. |
|
10
|
|
|
* It is free software; you can redistribute it and/or modify it |
|
11
|
|
|
* under the terms of the GNU General Public License, either |
|
12
|
|
|
* version 3 of the License, or any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* For the full copyright and license information, see: |
|
15
|
|
|
* http://www.gnu.org/licenses/gpl-3.0.html |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
namespace CuyZ\Notiz\Domain\Event\Form\Service; |
|
19
|
|
|
|
|
20
|
|
|
use CuyZ\Notiz\Domain\Event\Form\DispatchFormNotificationFinisher; |
|
21
|
|
|
use CuyZ\Notiz\Service\Container; |
|
22
|
|
|
use TYPO3\CMS\Core\SingletonInterface; |
|
23
|
|
|
use TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface; |
|
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
class ListFormNotifications implements SingletonInterface |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* @var FormPersistenceManagerInterface |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $formPersistenceManager; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Manual dependency injection. |
|
34
|
|
|
*/ |
|
35
|
|
|
public function __construct() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->formPersistenceManager = Container::get(FormPersistenceManagerInterface::class); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Loops on every registered form definition and checks if it uses the |
|
42
|
|
|
* notification dispatch finisher. If it does, the identifier is fetched and |
|
43
|
|
|
* added to the list. |
|
44
|
|
|
* |
|
45
|
|
|
* @param array $parameters |
|
46
|
|
|
*/ |
|
47
|
|
|
public function doList(array &$parameters) |
|
48
|
|
|
{ |
|
49
|
|
|
foreach ($this->formPersistenceManager->listForms() as $form) { |
|
50
|
|
|
$persistenceIdentifier = $form['persistenceIdentifier']; |
|
51
|
|
|
$formDefinition = $this->formPersistenceManager->load($persistenceIdentifier); |
|
52
|
|
|
$finishers = $formDefinition['finishers'] ?? []; |
|
53
|
|
|
|
|
54
|
|
|
foreach ($finishers as $finisher) { |
|
55
|
|
|
if ($finisher['identifier'] === DispatchFormNotificationFinisher::DISPATCH_NOTIFICATION) { |
|
56
|
|
|
$parameters['items'][] = [ |
|
57
|
|
|
$formDefinition['label'] . ' (' . $persistenceIdentifier . ')', |
|
58
|
|
|
$persistenceIdentifier, |
|
59
|
|
|
]; |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths