Reputation: 3249
After updating TYPO3, I get a TYPO3Fluid\Fluid\Core\ViewHelper\Exception
"Undeclared arguments passed to ViewHelper ... Valid arguments are."
Upvotes: 3
Views: 5377
Reputation: 3249
Tip: Use rector to make these (and other) conversions! Functions for TYPO3 are available, see
This may be due to an extension using functionality that has been dropped. Using only the TYPO3 core, you should not see this error.
In your extension: If you still use the render() method in your ViewHelper class with arguments, you may want to replace this:
before:
public function render(Mail $mail, $type = 'web', $function = 'createAction')
after:
public function initializeArguments()
{
parent::initializeArguments();
$this->registerArgument('mail', Mail::class, 'Mail', true);
$this->registerArgument('type', 'string', 'type: web | mail', false, 'web');
$this->registerArgument('function', 'string', 'function: createAction | senderMail | receiverMail', false, 'createAction');
}
public function render()
{
$mail = $this->arguments['mail'];
$type = $this->arguments['type'] ?? 'web';
// ...
}
Additionally,
TYPO3Fluid\Fluid\Core\ViewHelper
instead of TYPO3\CMS\Fluid\Core\ViewHelper
:// use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
Documentation:
Changelogs:
Upvotes: 12
Reputation: 331
You are using other extension that makes this error, for example: https://github.com/lochmueller/calendarize/issues/280
If you have a parameters in a ViewHelper, you send them as arguments from Fluid Template. In TYPO3 this error throws when in render()
function not have comments about parameters. You have to include them.
Example:
<?php
namespace VENDOR\ExtensionName\ViewHelpers;
class ExampleViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
{
/**
*
* @param int $foo
* @return boolean
*/
public function render($foo) {
//function render lines
return $bar_boolean;
}
}
Upvotes: 0