|
7 | 7 | CObject ViewHelper `<f:cObject>` |
8 | 8 | ================================ |
9 | 9 |
|
| 10 | +.. versionchanged:: 14.2 |
| 11 | + Instead of using the :html:`<f:cObject>` ViewHelper to render database records, |
| 12 | + the new `Render.record ViewHelper <f:render.record> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-render-record>`_ |
| 13 | + ViewHelper can be used to render database records and the new |
| 14 | + `Render.contentArea ViewHelper <f:render.contentArea> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-render-contentarea>`_ |
| 15 | + can be used to render all content elements within a column from a backend |
| 16 | + layout. |
| 17 | + |
10 | 18 | .. typo3:viewhelper:: cObject |
11 | 19 | :display: tags,description,gitHubLink |
12 | 20 | :source: ../Global.json |
@@ -45,36 +53,6 @@ The TypoScript could look like this: |
45 | 53 | lib.someLibObject = TEXT |
46 | 54 | lib.someLibObject.value = Hello World! |
47 | 55 |
|
48 | | -.. _typo3-fluid-cobject-content: |
49 | | - |
50 | | -Displaying content elements provided by the page-content data processor |
51 | | ------------------------------------------------------------------------ |
52 | | - |
53 | | -When using the `page-content data processor <https://docs.typo3.org/permalink/t3tsref:pagecontentfetchingprocessor>`_ |
54 | | -to display the content elements of a |
55 | | -`PAGEVIEW <https://docs.typo3.org/permalink/t3tsref:cobj-pageview>`_, |
56 | | -the CObject ViewHelper can be used to display the actual content elements: |
57 | | - |
58 | | -.. code-block:: html |
59 | | - :caption: packages/my_sitepackage/Resources/Private/Templates/Pages/Default.html |
60 | | - |
61 | | - <f:for each="{myContent.left.records}" as="contentElement"> |
62 | | - <f:cObject |
63 | | - typoscriptObjectPath="{contentElement.mainType}" |
64 | | - table="{contentElement.mainType}" |
65 | | - data="{contentElement}" |
66 | | - /> |
67 | | - </f:for> |
68 | | - |
69 | | -Variable `{contentElement.mainType}` already contains the correct TypoScript path |
70 | | -to the TypoScript top-level object `tt_content <https://docs.typo3.org/permalink/t3tsref:tlo-tt-content>`_. |
71 | | - |
72 | | -The table storing the content elements is also called `tt_content` so we can use |
73 | | -the same variable here. Variable `contentElement` already contains the |
74 | | -`Record object <https://docs.typo3.org/permalink/t3coreapi:record-objects>`_ |
75 | | -containing the data needed to render the content element with the |
76 | | -CObject ViewHelper. |
77 | | - |
78 | 56 | .. _typo3-fluid-cobject-plugin: |
79 | 57 |
|
80 | 58 | Use data from a plugin in TypoScript |
@@ -127,7 +105,7 @@ content data from a Fluid template to a content object defined in TypoScript. Th |
127 | 105 | following example demonstrates this with a user counter. The user counter is in |
128 | 106 | a blog post (the blog post has a count of how many times it has been viewed.) |
129 | 107 |
|
130 | | -Add the viewhelper to your Fluid template. This can be done in 3 different |
| 108 | +Add the Viewhelper to your Fluid template. This can be done in 3 different |
131 | 109 | ways. The basic tag syntax: |
132 | 110 |
|
133 | 111 | .. code-block:: html |
@@ -251,3 +229,48 @@ easier to understand. |
251 | 229 |
|
252 | 230 | In summary, the cObject ViewHelper is a powerful option to embed TypoScript |
253 | 231 | expressions in Fluid templates. |
| 232 | + |
| 233 | +.. _typo3-fluid-cobject-migration: |
| 234 | + |
| 235 | +Migration from the `f:cObject` to dedicated ViewHelpers for special cases |
| 236 | +========================================================================= |
| 237 | + |
| 238 | +.. _typo3-fluid-cobject-content: |
| 239 | + |
| 240 | +Migration: Use the `f:render.contentArea` ViewHelper |
| 241 | +---------------------------------------------------- |
| 242 | + |
| 243 | +.. versionchanged:: 14.2 |
| 244 | + Instead of using the :html:`<f:cObject>` ViewHelper to the new |
| 245 | + `Render.contentArea ViewHelper <f:render.contentArea> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-render-contentarea>`_ |
| 246 | + can be used to render all content elements within a column from a backend |
| 247 | + layout. |
| 248 | + |
| 249 | +When using the `page-content data processor <https://docs.typo3.org/permalink/t3tsref:pagecontentfetchingprocessor>`_ |
| 250 | +to display the content elements of a |
| 251 | +`PAGEVIEW <https://docs.typo3.org/permalink/t3tsref:cobj-pageview>`_, switch |
| 252 | +to using the |
| 253 | +`Render.contentArea ViewHelper <f:render.contentArea> <https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-render-contentarea>`_ |
| 254 | +on dropping TYPO3 v13 support: |
| 255 | + |
| 256 | +.. code-block:: diff |
| 257 | + :caption: packages/my_sitepackage/Resources/Private/Templates/Pages/Default.html (diff) |
| 258 | +
|
| 259 | + - <f:for each="{myContent.left.records}" as="contentElement"> |
| 260 | + - <f:cObject |
| 261 | + - typoscriptObjectPath="{contentElement.mainType}" |
| 262 | + - table="{contentElement.mainType}" |
| 263 | + - data="{contentElement}" |
| 264 | + - /> |
| 265 | + - </f:for> |
| 266 | +
|
| 267 | + + <f:render.contentArea contentArea="{myContent.left}" /> |
| 268 | +
|
| 269 | +Variable `{contentElement.mainType}` already contains the correct TypoScript path |
| 270 | +to the TypoScript top-level object `tt_content <https://docs.typo3.org/permalink/t3tsref:tlo-tt-content>`_. |
| 271 | + |
| 272 | +The table storing the content elements is also called `tt_content` so we can use |
| 273 | +the same variable here. Variable `contentElement` already contains the |
| 274 | +`Record object <https://docs.typo3.org/permalink/t3coreapi:record-objects>`_ |
| 275 | +containing the data needed to render the content element with the |
| 276 | +CObject ViewHelper. |
0 commit comments