Actions
Feature #103810
closedadd a general viewhelper which allow you to use nearly all php-function for manipulating strings in fluid
Start date:
2024-05-09
Due date:
% Done:
0%
Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:
Description
A viewhelper should allow to manipulate strings in a simple way to other 'formats'.
- I often needs a explode-viewhelper, which convert a comma-separated list into an array.
- I need sometimes a viewhelper which could convert a string to a string in lower case.
- ...
I wrote the viewhelper `convert`. The viewhelper allows the integrator, to use at least nearly any of the powerful php function for string-manipulation.
The behavior is a combination of <f:alias> and <f:variable>. It depends on the way how you define the string which should be manipulated.
Example:
<!-- stores the result of the complex php-function explode($limiter,$string, $limit) in a global fluid-variable -->
<f:convert phpfunc="explode" value="php,javascript,java,c++,ada,prolog,lisp,fortran," prev="{0:','} post="{0:3}" as="langList" />
<f:for each="{langList}" as="progLanguage">
<div>{progLanguage}</div>
<f:for>
<!-- output:
<div>php</div>
<div>javascript</div>
<div>java,c++,ada,prolog,lisp,fortran,</div>
-->
<!-- defines the result of the complex php-function explode($limiter,$string, $limit) only for the nested html via 'local="1"' -->
<f:convert phpfunc="explode" value="php,javascript,java,c++,ada,prolog,lisp,fortran," prev="{0:','} post="{0:3}" as="langList" local="1" >
<f:for each="{langList}" as="progLanguage">
<div>{progLanguage}</div>
<f:for>
</f:convert>
<!-- output:
<div>php</div>
<div>javascript</div>
<div>java,c++,ada,prolog,lisp,fortran,</div>
-->
Files
Updated by Georg Ringer 5 months ago
- Status changed from New to Rejected
Hey Dieter,
thanks for creating this issue! I am rejecting this feature request for the following reasons:
- From MVC point of view, this should be done in the controller/service class
- I understand, that sometimes such thing is really nice from an integrator point of view but there is already e.g. https://viewhelpers.fluidtypo3.org/fluidtypo3/vhs/5.0.1/Iterator/Explode.html
- It is really easy to provide such VHs on your own.
feel free to contact me via slack if you want to discuss the current viewhelper and their limitations.
Updated by Garvin Hicking 5 months ago
Actions