Deprecation: #107648 - InfoboxViewHelper STATE_* constants
See forge#107648
Description
The public constants in
\TYPO3\ for defining
the state or severity of an infobox have been deprecated:
InfoboxView Helper:: STATE_ NOTICE InfoboxView Helper:: STATE_ INFO InfoboxView Helper:: STATE_ OK InfoboxView Helper:: STATE_ WARNING InfoboxView 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 PHP
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 backward
compatibility.
Mapping table
| Deprecated constant | Replacement | Value |
|---|---|---|
Infobox | Contextual | -2 |
Infobox | Contextual | -1 |
Infobox | Contextual | 0 |
Infobox | Contextual | 1 |
Infobox | Contextual | 2 |