Skip to content
Snippets Groups Projects
Commit 0034fe62 authored by Roberto Torresani's avatar Roberto Torresani Committed by Andreas Fernandez
Browse files

[TASK] Move arguments to initializeArguments() in ResourceVH in ext:fluid

Move the argument registrations away from the render() method
to initializeArguments(), to prevent any errors with PHP7 and
subclassed ViewHelpers if/when render() method signatures change

Resolves: #77010
Releases: master
Change-Id: I53b08bcf4da1b9b319cbe9411c361db9894e5644
Reviewed-on: https://review.typo3.org/48875


Tested-by: default avatarBamboo TYPO3com <info@typo3.com>
Reviewed-by: default avatarAnna Färber <anna.faerber@dkd.de>
Tested-by: default avatarAnna Färber <anna.faerber@dkd.de>
Reviewed-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
parent 08d691ea
No related merge requests found
......@@ -31,17 +31,32 @@ use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
*/
class ResourceViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
{
/**
* Initialize arguments
*
* @return void
* @api
*/
public function initializeArguments()
{
parent::initializeArguments();
$this->registerArgument('path', 'string', 'The path and filename of the resource (relative to Public resource directory of the extension).', true);
$this->registerArgument('extensionName', 'string', 'Target extension name. If not set, the current extension name will be used');
$this->registerArgument('absolute', 'bool', 'If set, an absolute URI is rendered', false, false);
}
/**
* Render the URI to the resource. The filename is used from child content.
*
* @param string $path The path and filename of the resource (relative to Public resource directory of the extension).
* @param string $extensionName Target extension name. If not set, the current extension name will be used
* @param bool $absolute If set, an absolute URI is rendered
* @return string The URI to the resource
* @api
*/
public function render($path, $extensionName = null, $absolute = false)
public function render()
{
$path = $this->arguments['path'];
$extensionName = $this->arguments['extensionName'];
$absolute = $this->arguments['absolute'];
return static::renderStatic(
array(
'path' => $path,
......
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