Skip to content
Snippets Groups Projects
Commit 93fde513 authored by Garvin Hicking's avatar Garvin Hicking
Browse files

[DOCS] Add verbose renderStatic fluid ViewHelper migration steps

This is an effort to document the steps that were made in
issue #104786 to allow developers and probably integrators
to migrate affected ViewHelpers easier.

The goal is to lower unneeded fears of possibly complex
migrations, because the steps can actually be performed
mostly even with search+replace.

Resolves: #104824
Related: #104799
Related: #104789
Related: #104786
Releases: main
Change-Id: I06bd649c2ff9a4a84c31dfec9d9bcc7c6f2b81f8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85893


Tested-by: default avatarSimon Praetorius <simon@praetorius.me>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarGarvin Hicking <gh@faktor-e.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarGarvin Hicking <gh@faktor-e.de>
Reviewed-by: default avatarSimon Praetorius <simon@praetorius.me>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
parent 3d30bbf4
Branches
Tags
No related merge requests found
......@@ -114,4 +114,42 @@ After:
}
}
Here is a basic recipe to perform this migration, preferably utilizing
statical code analysis/replacement tools on your :file:`*ViewHelper.php`
files:
* Find definitions of :php:`renderStatic`
* Rename method to :php:`render()`, remove the arguments, remove :php:`static` declaration
* Within that method:
* Replace :php:`$arguments` with :php:`$this->arguments`
* Replace :php:`$renderingContext` with :php:`$this->renderingContext`
* Replace :php:`$renderChildrenClosure()` with :php:`$this->renderChildren()`
* Replace remaining :php:`$renderChildrenClosure` usages with proper closure handling, like :php:`$this->renderChildren(...)`.
* Replace :php:`resolveContentArgumentName(` with :php:`getContentArgumentName(`
* Remove the mentioned definitions:
* :php:`use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
* :php:`use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;`
* :php:`use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithContentArgumentAndRenderStatic;`
* :php:`use CompileWithRenderStatic;` (class trait)
* :php:`use CompileWithContentArgumentAndRenderStatic;` (class trait)
* (Optionally remove custom phpdoc annotations to the `renderStatic` parameters)
* If you previously called ViewHelper's :php:`renderStatic` methods in other places,
you may utilize something like:
.. code-block:: php
$this->renderingContext->getViewHelperInvoker()->invoke(
MyViewHelper::class,
$arguments,
$this->renderingContext,
$this->renderChildren(...),
);
.. index:: Fluid, PartiallyScanned, ext:fluid
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment