#31969cropHTML, dynamic max number of chars
Description
It would be nice if cropHTML (and crop) could handle variables as first parameter inside $options. Would take just one additional line of code in root/typo3/sysext/cms/tslib/class.tslib_content.php:
function cropHTML($content, $options) {
$options = explode('|', $options);
// added next line to process $options[0] with insertData and so be able to use variables for cropping length
$options[0] = $this->insertData($options[0]);
$chars = intval($options[0]);
So one could use constants or register values to pass to cropHTML like
tt_content.text.20.cropHTML = {$contentCropLength} | … | 1
tt_content.text.20.insertData = 1
or
tt_content.text.20.cropHTML = {register:croplength} | … | 1
tt_content.text.20.insertData = 1
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 11
-
Mathias Schreiber commented and changed category status
NewAccepted target version PHP Version 5.5 12/04/14, 17:04 -
Mathias Schreiber changed target version 12/23/14, 19:46
-
Benni Mack changed target version 06/15/15, 17:44
-
Susanne Moog changed target version 08/05/15, 10:31
-
Benni Mack changed target version 09/24/15, 20:35
-
Riccardo De Contardi changed target version 02/23/17, 14:55
-
Susanne Moog changed target version 01/28/18, 14:52
-
Susanne Moog changed target version 09/06/18, 14:07
-
Susanne Moog changed Sprint Focus On Location Sprint 08/05/22, 13:22
-
Oliver Hader changed Sprint Focus
On Location Sprint11/03/22, 09:04 -
Benni Mack commented and changed status
AcceptedRejected 06/14/24, 20:34Hi Daniel,
unfortunately, as statistics show us — people don’t use TypoScript for more sophisticated parts anymore – either they use custom data processors, or they just a Fluid ViewHelper. I recommend doing this as well, as – after all these years – looks like we don’t find anymore adding this feature and find a valid use-case (nowadays) for it.
I hope this is OK for you! Sorry for keeping you waiting for so long.
Might need some additional testing if the value transmitted s a variable but apart from that… nice addition