@@ -24,13 +24,17 @@ Be.infobox ViewHelper `<f:be.infobox>`
2424Severity states of the Be.infobox ViewHelper
2525============================================
2626
27+ .. deprecated :: 14.0
28+ The public constants in :php-short: `\T YPO3\C MS\F luid\V iewHelpers\B e\I nfoboxViewHelper `
29+ for defining the state/severity of an infobox have been deprecated. Use
30+ the enum :php: `\T YPO3\C MS\C ore\T ype\C ontextualFeedbackSeverity ` instead.
31+
2732The Infobox provides different context-sensitive states that
2833can be used to provide an additional visual feedback to the
29-
3034user to underline the meaning of the information.
3135
32- Possible values are in range from `` -2 `` to `` 2 ``. Please choose a
33- meaningful value from the following list .
36+ The ` state ` property allows enums of type :php: ` \T YPO3 \C MS \C ore \T ype \C ontextualFeedbackSeverity `
37+ and integer values between ` -2 ` and ` +2 ` for backward compatibility .
3438
3539.. tabs ::
3640
@@ -41,32 +45,32 @@ meaningful value from the following list.
4145
4246 A demonstration of all possible states
4347
44- .. group-tab :: Numeral values
48+ .. group-tab :: Enum values
4549
46- `` -2 ``
50+ `ContextualFeedbackSeverity::NOTICE ` (-2)
4751 Notices (Default)
48- `` -1 ``
52+ `ContextualFeedbackSeverity::INFO ` (-1)
4953 Information
50- `` 0 ``
54+ `ContextualFeedbackSeverity::OK ` (0)
5155 Positive feedback
52- `` 1 ``
56+ `ContextualFeedbackSeverity::WARNING ` (1)
5357 Warnings
54- `` 2 ``
58+ `ContextualFeedbackSeverity::ERROR ` (2)
5559 Error
5660
5761 .. group-tab :: Code example
5862
5963 It is considered best practice to use the states from
60- :php: `\T YPO3\C MS\F luid \V iewHelpers \B e \I nfoboxViewHelper ` together with the
64+ :php: `\T YPO3\C MS\C ore \T ype \C ontextualFeedbackSeverity ` enum together with the
6165 `Constant ViewHelper <f:constant> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-constant >`_:
6266
6367 .. literalinclude :: _Infobox/_States.html
6468 :caption: EXT:my_extension/Resources/Private/Backend/Templates/MyModule.html
6569
6670.. _typo3-fluid-be-infobox-example :
6771
68- Examples
69- ========
72+ Examples of Be.infobox ViewHelper usage
73+ =======================================
7074
7175Info box of level notice with a static title and a static text:
7276
@@ -77,29 +81,14 @@ Info box of level notice with a static title and a static text:
7781
7882Warning box with disabled icon:
7983
80- .. code-block :: html
84+ .. literalinclude :: _Infobox/_Warning. html
8185 :caption: EXT:my_extension/Resources/Private/Backend/Templates/MyModule.html
8286
83- <f:be .infobox
84- title =" Message title"
85- message =" your box content"
86- state =" {f:constant(name: 'TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper::STATE_WARNING')}"
87- disableIcon =" true"
88- />
89-
9087Success box with custom icon:
9188
92- .. code-block :: html
89+ .. literalinclude :: _Infobox/_CustomIcon. html
9390 :caption: EXT:my_extension/Resources/Private/Backend/Templates/MyModule.html
9491
95- <f:be .infobox
96- title =" Message title"
97- message =" your box content"
98- state =" {f:constant(name: 'TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper::STATE_OK')}"
99- iconName =" check"
100- />
101-
102-
10392.. _typo3-fluid-be-infobox-example-html :
10493
10594Infobox with HTML content, icon and links
@@ -112,6 +101,26 @@ You can find this example in the TYPO3 backend module
112101.. literalinclude :: _Infobox/_ReferenceIndex.html
113102 :caption: EXT:lowlevel/Resources/Private/Templates/ReferenceIndex.html
114103
104+ .. _typo3-fluid-be-infobox-migration :
105+
106+ Migration from using InfoboxViewHelper state constants
107+ ------------------------------------------------------
108+
109+ If you want to support both TYPO3 v13 and v14 you can keep using the constants
110+ until dropping TYPO3 13 support.
111+
112+ After dropping TYPO3 13 support migrate as follows:
113+
114+ .. literalinclude :: _Infobox/_Migration.diff
115+ :caption: EXT:my_extension/Resources/Private/Backend/Templates/MyModule.html
116+
117+ In PHP code replace the severity by using the enum or their value instead of the
118+ constants:
119+
120+ .. literalinclude :: _Infobox/_Migration.php
121+ :caption: EXT:my_extension/Classes/Controller/MyController.php
122+
123+
115124.. _typo3-fluid-be-infobox-arguments :
116125
117126Arguments
0 commit comments