Reputation: 423
I have an old extbase extension that needs to be fixed after updating from 7.6 to TYPO3 9.5.8:
This line seems to be the problem:
$this->registerArgument('background', FileReference::class . '|boolean', 'Image');
The error I get is
The argument "background" was registered with type "TYPO3\CMS\Extbase\Domain\Model\FileReference|boolean", but is of type "TYPO3\CMS\Extbase\Domain\Model\FileReference" in view helper
However, if I remove the |boolean I get a new error, this time
The argument "background" was registered with type "TYPO3\CMS\Extbase\Domain\Model\FileReference", but is of type "boolean" in view helper
So I am kind of in a loop here. Any ideas?
Upvotes: 0
Views: 364
Reputation: 423
I was able to solve the issue by turning the type to "string". Still not sure why It sent me in a loop before...
Upvotes: 0
Reputation: 2252
I found the function in typo3_src/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper
/**
* Register a new argument. Call this method from your ViewHelper subclass
* inside the initializeArguments() method.
*
* @param string $name Name of the argument
* @param string $type Type of the argument
* @param string $description Description of the argument
* @param boolean $required If TRUE, argument is required. Defaults to FALSE.
* @param mixed $defaultValue Default value of argument
* @return \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper $this, to allow chaining.
* @throws Exception
* @api
*/
protected function registerArgument($name, $type, $description, $required = false, $defaultValue = null)
{
if (array_key_exists($name, $this->argumentDefinitions)) {
throw new Exception(
'Argument "' . $name . '" has already been defined, thus it should not be defined again.',
1253036401
);
}
$this->argumentDefinitions[$name] = new ArgumentDefinition($name, $type, $description, $required, $defaultValue);
return $this;
}
So I think you have to use
$this->registerArgument('background', TYPO3\CMS\Extbase\Domain\Model\FileReference, 'Image');
Upvotes: 0