Skip to content
Snippets Groups Projects
Commit 7d050ea0 authored by Claus Due's avatar Claus Due Committed by Georg Ringer
Browse files

[TASK] Add base Widget class methods for Fluid 3.0 compat

Adds two new methods, evaluate() and onClose() which
makes Widgets compatible with Fluid 3.0 but which are
never called on Fluid 2.x.

Releases: master, 9.5, 8.7
Resolves: #90286
Change-Id: I36a99c30e7c3bb5baae065cfc6368a2bf493cc40
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63133


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
parent f348b205
Branches
Tags
No related merge requests found
......@@ -14,8 +14,10 @@ namespace TYPO3\CMS\Fluid\Core\Widget;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3Fluid\Fluid\Component\ComponentInterface;
use TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
abstract class AbstractWidgetViewHelper extends AbstractViewHelper
......@@ -124,6 +126,38 @@ abstract class AbstractWidgetViewHelper extends AbstractViewHelper
return $this->callRenderMethod();
}
/**
* Initialize the arguments of the ViewHelper, and call the render() method of the ViewHelper.
*
* @param RenderingContextInterface $renderingContext
* @return string the rendered ViewHelper.
* @internal
*/
public function evaluate(RenderingContextInterface $renderingContext)
{
$this->renderingContext = $renderingContext;
$this->getArguments()->setRenderingContext($renderingContext);
$this->initializeWidgetContext();
return $this->callRenderMethod();
}
/**
* Stores the syntax tree child nodes in the Widget Context, so they can be
* rendered with <f:widget.renderChildren> lateron.
*
* @param RenderingContextInterface $renderingContext
* @return ComponentInterface
* @internal
*/
public function onClose(RenderingContextInterface $renderingContext): ComponentInterface
{
$node = parent::onClose($renderingContext);
$rootNode = $this->objectManager->get(\TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode::class);
$rootNode->setChildren($this->getChildren());
$this->widgetContext->setViewHelperChildNodes($rootNode, $renderingContext);
return $node;
}
/**
* Initialize the Widget Context, before the Render method is called.
*/
......
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