Skip to content

Commit

Permalink
[TASK] Use ContextualFeedbackSeverity instead of AbstractMessage to s…
Browse files Browse the repository at this point in the history
…et severity
  • Loading branch information
christianbltr committed Jan 5, 2024
1 parent 1ef11b5 commit 3f70f0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Upcoming version
[TASK] Add ignore annotations for extension scanner false positives
[TASK] Replace usage of deprecated functions orX() and andX()
[TASK] Add label to "Index Overview" widget (shown since TYPO3 12), and use only one color in the bar chart
[TASK] Use ContextualFeedbackSeverity instead of AbstractMessage to set severity

Version 5.2.0, 8 December 2023
[!!!] The pagebrowser is now rendered in a different way (using the pagination API). If you used a custom template for the pagebrowser you will have to adopt it. Have a look at Resources/Private/Partials/PageBrowser.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
namespace Tpwd\KeSearch\UserFunction\CustomFieldValidation;

use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

Expand All @@ -50,12 +52,18 @@ public function evaluateFieldValue($value)
$minLength = isset($extConf['searchWordLength']) ? (int)$extConf['searchWordLength'] : 4;

if (strlen($value) < $minLength) {
if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 12) {
// @extensionScannerIgnoreLine
$severity = AbstractMessage::ERROR;
} else {
$severity = ContextualFeedbackSeverity::ERROR;

Check failure on line 59 in Classes/UserFunction/CustomFieldValidation/FilterOptionTagValidator.php

View workflow job for this annotation

GitHub Actions / Build PHP/TYPO3 (8.1, ^11)

Access to constant ERROR on an unknown class TYPO3\CMS\Core\Type\ContextualFeedbackSeverity.

Check failure on line 59 in Classes/UserFunction/CustomFieldValidation/FilterOptionTagValidator.php

View workflow job for this annotation

GitHub Actions / Build PHP/TYPO3 (7.4, ^11)

Access to constant ERROR on an unknown class TYPO3\CMS\Core\Type\ContextualFeedbackSeverity.

Check failure on line 59 in Classes/UserFunction/CustomFieldValidation/FilterOptionTagValidator.php

View workflow job for this annotation

GitHub Actions / Build PHP/TYPO3 (8.0, ^11)

Access to constant ERROR on an unknown class TYPO3\CMS\Core\Type\ContextualFeedbackSeverity.
}
/** @var FlashMessage $message */
$message = GeneralUtility::makeInstance(
FlashMessage::class,
$this->translate('tag_too_short_message', [$value, $minLength]),
$this->translate('tag_too_short'),
AbstractMessage::ERROR,
$severity,
true
);

Expand Down

0 comments on commit 3f70f0b

Please sign in to comment.