CuyZ /
NotiZ
| 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\ViewHelpers\Notification\Link; |
||
| 19 | |||
| 20 | use CuyZ\Notiz\Core\Definition\Tree\EventGroup\Event\EventDefinition; |
||
| 21 | use CuyZ\Notiz\Core\Definition\Tree\Notification\NotificationDefinition; |
||
| 22 | use CuyZ\Notiz\Core\Notification\Creatable; |
||
| 23 | use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper; |
||
|
0 ignored issues
–
show
|
|||
| 24 | |||
| 25 | class CreateViewHelper extends AbstractTagBasedViewHelper |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | protected $tagName = 'a'; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @inheritdoc |
||
| 34 | */ |
||
| 35 | public function initializeArguments() |
||
| 36 | { |
||
| 37 | parent::initializeArguments(); |
||
| 38 | |||
| 39 | $this->registerUniversalTagAttributes(); |
||
| 40 | |||
| 41 | $this->registerArgument( |
||
| 42 | 'notificationDefinition', |
||
| 43 | NotificationDefinition::class, |
||
| 44 | '', |
||
| 45 | true |
||
| 46 | ); |
||
| 47 | |||
| 48 | $this->registerArgument( |
||
| 49 | 'eventDefinition', |
||
| 50 | EventDefinition::class, |
||
| 51 | '' |
||
| 52 | ); |
||
| 53 | |||
| 54 | $this->registerArgument( |
||
| 55 | 'addUriTemplate', |
||
| 56 | 'bool', |
||
| 57 | '' |
||
| 58 | ); |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @inheritdoc |
||
| 63 | */ |
||
| 64 | public function render() |
||
| 65 | { |
||
| 66 | /** @var NotificationDefinition $notificationDefinition */ |
||
| 67 | $notificationDefinition = $this->arguments['notificationDefinition']; |
||
| 68 | |||
| 69 | /** @var Creatable $className */ |
||
| 70 | $className = $notificationDefinition->getClassName(); |
||
| 71 | |||
| 72 | if (!in_array(Creatable::class, class_implements($className)) |
||
| 73 | || !$className::isCreatable() |
||
| 74 | ) { |
||
| 75 | return ''; |
||
| 76 | } |
||
| 77 | |||
| 78 | if ($this->arguments['addUriTemplate']) { |
||
| 79 | $this->tag->addAttribute('data-href', $className::getCreationUri('#EVENT#')); |
||
| 80 | } |
||
| 81 | |||
| 82 | /** @var EventDefinition $eventDefinition */ |
||
| 83 | $eventDefinition = $this->arguments['eventDefinition']; |
||
| 84 | |||
| 85 | $selectedEvent = $eventDefinition |
||
|
0 ignored issues
–
show
|
|||
| 86 | ? $eventDefinition->getFullIdentifier() |
||
| 87 | : null; |
||
| 88 | |||
| 89 | $this->tag->addAttribute('href', $className::getCreationUri($selectedEvent)); |
||
| 90 | $this->tag->setContent($this->renderChildren()); |
||
| 91 | |||
| 92 | return $this->tag->render(); |
||
| 93 | } |
||
| 94 | } |
||
| 95 |
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