更新TYPO3后,我得到一个TYPO3Fluid\Fluid\Core\ViewHelper\Exception“未声明的参数传递给ViewHelper .有效参数是”。
发布于 2019-07-30 15:07:41
提示:使用校长使这些(和其他)转换!TYPO3的函数可用,请参阅
这可能是由于使用了已删除的功能的扩展。只使用TYPO3核心,您就不会看到这个错误。
在扩展中:如果仍然在ViewHelper类中使用render()方法和参数,则可能需要替换以下内容:
在此之前:
public function render(Mail $mail, $type = 'web', $function = 'createAction')之后:
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';
// ...
}另外,
TYPO3Fluid\Fluid\Core\ViewHelper中的类继承而不是从TYPO3\CMS\Fluid\Core\ViewHelper继承// use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;文档:
Changelogs:
发布于 2019-07-30 22:35:56
您正在使用其他导致此错误的扩展,例如:https://github.com/lochmueller/calendarize/issues/280
如果ViewHelper中有参数,则将它们作为流体模板的参数发送。在TYPO3中,当在render()函数中没有关于参数的注释时,此错误抛出。你得把他们包括进去。
示例:
<?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;
}
}https://stackoverflow.com/questions/57274811
复制相似问题