[TYPO3-mvc] new feature proposal: f:format.crop returns whole if set to 0
Stefano Cecere
scecere at krur.com
Sun Mar 6 16:48:30 CET 2011
hi,
i see that the .crop function hasn't an option to NOT crop
i often need to set it to "NOT CROP" anything, without major changes in
TS, or Fluid templates.
i could easily get this option, for example if the crop value is set to 0,
modifying file
~/Sites/typo3_src-4.5.2/typo3/sysext/fluid/Classes/ViewHelpers/Format/CropViewHelper.php
with a simple condition:
if ( $maxCharacters > 0 ) {
if ($respectHtml) {
$content = $this->contentObject->cropHTML($stringToTruncate,
$maxCharacters . '|' . $append . '|' . $respectWordBoundaries);
} else {
$content = $this->contentObject->crop($stringToTruncate,
$maxCharacters . '|' . $append . '|' . $respectWordBoundaries);
}
} else {
$content = $stringToTruncate;
}
in this way, for example in a fluid tempalte with
<f:format.crop maxCharacters="{settings.cropLength}"
respectWordBoundaries="true">{newsItem.bodytext}</f:format.crop>
we just need to set settings.cropLength = 0, and you got the full bodytext
what do you think?
--
____ ___ __ _ ______________________
Stefano Cecere
krur.com multimedia
More information about the TYPO3-project-typo3v4mvc
mailing list