Deprecation: #107648 - InfoboxViewHelper STATE_* constants
See forge#107648
Description
The public constants in
\TYPO3\
for defining the state/severity of an infobox have been deprecated:
\TYPO3\
CMS\ Fluid\ View Helpers\ Be\ Infobox View Helper:: STATE_ NOTICE \TYPO3\
CMS\ Fluid\ View Helpers\ Be\ Infobox View Helper:: STATE_ INFO \TYPO3\
CMS\ Fluid\ View Helpers\ Be\ Infobox View Helper:: STATE_ OK \TYPO3\
CMS\ Fluid\ View Helpers\ Be\ Infobox View Helper:: STATE_ WARNING \TYPO3\
CMS\ Fluid\ View Helpers\ Be\ Infobox View Helper:: STATE_ ERROR
These constants have been superseded by the dedicated enum
\TYPO3\
, which provides
a single source of truth for severity levels across the entire TYPO3
Core and improves type safety and maintainability.
Impact
Using these constants will trigger a PHP deprecation warning. The constants will be removed in TYPO3 v15.0. The extension scanner will report usages as weak match.
Affected installations
Instances using any of the
STATE_*
constants from
Infobox
in their code or Fluid templates.
Migration
Replace the deprecated constants with the corresponding
Contextual
enum.
Important
Whenever possible, use the enum directly instead of extracting its integer
value. This provides better type safety and makes the code more expressive.
Only use
->value
when you explicitly need the integer representation.
// Before
use TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper;
$state = InfoboxViewHelper::STATE_ERROR;
// After - Recommended: Use the enum directly
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
$severity = ContextualFeedbackSeverity::ERROR;
// Alternative: Use the integer value when explicitly needed
$stateValue = ContextualFeedbackSeverity::ERROR->value;
In Fluid templates, use the enum via
f:
:
<!-- Before -->
<f:be.infobox title="Error!"
state="{f:constant(name: 'TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper::STATE_ERROR')}">
Error message
</f:be.infobox>
<!-- After -->
<f:be.infobox title="Error!"
state="{f:constant(name: 'TYPO3\CMS\Core\Type\ContextualFeedbackSeverity::ERROR')}">
Error message
</f:be.infobox>
The
Infobox
has been updated to accept both the enum directly
and integer values for backwards compatibility.
Mapping table:
Deprecated constant | Replacement | Value |
---|---|---|
InfoboxViewHelper::STATE_NOTICE | ContextualFeedbackSeverity::NOTICE->value | -2 |
InfoboxViewHelper::STATE_INFO | ContextualFeedbackSeverity::INFO->value | -1 |
InfoboxViewHelper::STATE_OK | ContextualFeedbackSeverity::OK->value | 0 |
InfoboxViewHelper::STATE_WARNING | ContextualFeedbackSeverity::WARNING->value | 1 |
InfoboxViewHelper::STATE_ERROR | ContextualFeedbackSeverity::ERROR->value | 2 |