-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Description
Description
In Fluid inline syntax using the pipe operator, ViewHelpers that rely on getContentArgumentName() behave inconsistently when the content argument is required.
Works (no exception)
{content.content -> my:wrap()}
Fails (throws exception)
{content.content -> my:wrap(xxx: '')}
Error
Required argument "content" was not supplied. (error code 1237823699)
Minimal example ViewHelper (uses renderChildren())
<?php
declare(strict_types=1);
namespace Vendor\Extension\ViewHelpers;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
final class WrapViewHelper extends AbstractViewHelper
{
public function initializeArguments(): void
{
// required "content argument" as defined by getContentArgumentName()
$this->registerArgument('content', 'string', 'Content from pipe', true);
$this->registerArgument('xxx', 'string', 'Unused optional argument', false, '');
}
public function getContentArgumentName(): string
{
return 'content';
}
public function render(): string
{
return '[' . (string)$this->renderChildren() . ']';
}
}Scope
Affects any ViewHelper where:
- the content argument (via
getContentArgumentName()) is required - used inline with the pipe operator
- any additional named argument is passed
Expected
Piped value should still satisfy the required content argument even when other args are provided.
Actual
Adding any named argument causes the piped value to not be mapped to the required content argument, triggering the exception.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels