-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing Functionality in Fluid - Collection #862
Comments
Definitely would love to see the remaining functionality of Twig in Fluid.
So changes could be made within the scope of the rendered partial or section. But if it is meant for a template then this would be more akin to an include? E.g.
Could of course also be called |
Thank you for your feedback! I just want to leave a few comments here. I think, once we've accomplished some of the quick wins (ViewHelpers), we can close this issue and open separate ones for the bigger feature requests.
This should already be possible: <f:for each="{myArray}" as="item" reverse="1">
Just want to leave that here, since it's buried in a review:
Do you mean with numbers, like
Probably a bit more tough to implement, but valid.
I think that 3 ViewHelpers make more sense here to avoid the string constants.
Can we use It would also be nice to provide one array with key-value pairs (which str_replace() unfortunately doesn't allow). Maybe support these variants: <f:replace value="HELLO###SPACE###FRIENDS" search="###SPACE###" replace=" " />
<f:replace value="HELLO###SPACE###FRIENDS" search="{0: '###SPACE###'}" replace="{0: ' '}" />
<f:replace value="HELLO###SPACE###FRIENDS" replace="{'###SPACE###': ' '}" /> |
@s2b Maybe this could be used as a starting point for a parent view helper
|
Currently, there are contexts such as BackendPreviews or fluid templates in content blocks where preparing data is challenging, and no view helpers are available for a straightforward approach. I've seen solutions where developers crafted a workaround by looping with <f:variable> and self-rendering sections. Being able to repeat a snippet multiple times would be a valuable initial capability. <f:repeat times="{slotCount}">
<div class="item-slot"></div>
</f:repeat> Its easy to do quick and dirty way: namespace Your\Extension\ViewHelpers;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
class RepeatViewHelper extends AbstractViewHelper {
public function initializeArguments() {
$this->registerArgument('times', 'int', 'How many times to repeat the content', true);
}
public function render() {
$times = $this->arguments['times'];
$output = '';
for ($i = 0; $i < $times; $i++) {
$output .= $this->renderChildren();
}
return $output;
}
} But it would be great to have as a standard viewhelper |
Arrays
Strings
Parent Rendering
I want to be able to render parts of an overwritten template.
Conditions
First / Last
Min / Max / Random
Round
Alternative: Dedicated ViewHelpers for each.
Replace #863
Replace a string, with another one.
The text was updated successfully, but these errors were encountered: