diff --git a/.github/workflows/test-documentation.yml b/.github/workflows/test-documentation.yml index 79ac662ea..82d23fed3 100644 --- a/.github/workflows/test-documentation.yml +++ b/.github/workflows/test-documentation.yml @@ -14,4 +14,4 @@ jobs: run: | mkdir -p Documentation-GENERATED-temp \ && docker run --rm --pull always -v $(pwd):/project \ - ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --fail-on-log + ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --minimal-test diff --git a/Documentation/ContentObjects/Extbaseplugin/Index.rst b/Documentation/ContentObjects/Extbaseplugin/Index.rst index a22b04f50..1953d5074 100644 --- a/Documentation/ContentObjects/Extbaseplugin/Index.rst +++ b/Documentation/ContentObjects/Extbaseplugin/Index.rst @@ -52,8 +52,8 @@ Properties .. _cobj-extbaseplugin-examples: -Example -======= +Example: Display an Extbase plugin via TypoScript +================================================= .. code-block:: typoscript :caption: EXT:my_extension/Configuration/TypoScript/setup.typoscript @@ -62,6 +62,43 @@ Example page.10.extensionName = MyExtension page.10.pluginName = MyPlugin +.. _cobj-extbaseplugin-examples-fluid: + +Example: Display an Extbase plugin in a Fluid template +====================================================== + +It is possible to display an Extbase plugin in Fluid using the +:ref:`CObject ViewHelper `: + +.. literalinclude:: _CodeSnippets/_SomeTemplate.html + :caption: EXT:my_extension/Resources/Private/Templates/Pages/SomeTemplate.html + +Create a lib object which utilizes the :typoscript:`EXTBASEPLUGIN` into +a :typoscript:`lib` object: + +.. literalinclude:: _CodeSnippets/_libMyPlugin.typoscript + :caption: EXT:my_extension/Configuration/TypoScript/setup.typoscript + +For `extensionName` and `pluginName` use the names as configured in +:php:`\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin()`: + +.. literalinclude:: _CodeSnippets/_configurePlugin.php + :caption: EXT:my_extension/ext_localconf.php + :emphasize-lines: 9,10 + +If you passed data to the ViewHelper, you can access the data in the controller's +action by getting the currentContentObject from the request: + +.. literalinclude:: _CodeSnippets/_MyController.php + :caption: EXT:my_extension/Classes/Controller/MyController.php + :emphasize-lines: 16,17 + +.. note:: + You should treat all data from the + :php-short:`\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer` as + potential user input. Do not use it unescaped and do not trust to receive + certain types. + .. _cobj-extbaseplugin-history: History diff --git a/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_MyController.php b/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_MyController.php new file mode 100644 index 000000000..a2ef3c794 --- /dev/null +++ b/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_MyController.php @@ -0,0 +1,23 @@ +request->getAttribute('currentContentObject'); + $dataFromTypoScript = $contentObject->data; + $someValue = (int)($dataFromTypoScript['someValue'] ?? 0); + $someSetting = $dataFromTypoScript['someSetting'] ?? ''; + // Do something + return $this->htmlResponse(); + } +} diff --git a/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_SomeTemplate.html b/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_SomeTemplate.html new file mode 100644 index 000000000..98e5d30e3 --- /dev/null +++ b/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_SomeTemplate.html @@ -0,0 +1,5 @@ + + diff --git a/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_configurePlugin.php b/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_configurePlugin.php new file mode 100644 index 000000000..bcd9da7eb --- /dev/null +++ b/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_configurePlugin.php @@ -0,0 +1,14 @@ + 'list, show'], + [], + ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT, +); diff --git a/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_libMyPlugin.typoscript b/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_libMyPlugin.typoscript new file mode 100644 index 000000000..cbea150d7 --- /dev/null +++ b/Documentation/ContentObjects/Extbaseplugin/_CodeSnippets/_libMyPlugin.typoscript @@ -0,0 +1,6 @@ +lib.myPlugin = EXTBASEPLUGIN +lib.myPlugin { + extensionName = MyExtension + pluginName = MyPlugIn1 + settings.detailPid = 42 +} diff --git a/Documentation/DataProcessing/_PageContentFetchingProcessor/_Default.html b/Documentation/DataProcessing/_PageContentFetchingProcessor/_Default.html index 2fc21440f..6b8c2d636 100644 --- a/Documentation/DataProcessing/_PageContentFetchingProcessor/_Default.html +++ b/Documentation/DataProcessing/_PageContentFetchingProcessor/_Default.html @@ -1,8 +1,8 @@
-

{contentElement.data.header}

-

{contentElement.data.bodytext -> f:format.html()}

+

{contentElement.header}

+

{contentElement.bodytext -> f:format.html()}