-
Notifications
You must be signed in to change notification settings - Fork 0
Description
ℹ️ View this commit on Github
👥 Authored by Elias Häußler [email protected]
✔️ Merged by Benni Mack [email protected]
Commit message
[FEATURE] Allow number of decimals in stdWrap.bytes function
The TypoScript function stdWrap.bytes now accepts an additional
configuration parameter decimals. It allows to explicitly define the
number of decimals in the resulting number representation. By default,
the number of decimals is derived from the formatted size.
In addition, the consumed PHP function GU::formatSize() is extended
as well. The additional parameter $decimals is added and defaults to
null, which results in the same behavior as for the TypoScript
function stdWrap.bytes.
Resolves: #108344
Releases: main
Change-Id: I029c67c34cc6935e7736b114104be185f1bf8b6c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/91907
Tested-by: Simon Schaufelberger [email protected]
Reviewed-by: Benni Mack [email protected]
Tested-by: core-ci [email protected]
Tested-by: Benni Mack [email protected]
Reviewed-by: Simon Schaufelberger [email protected]
➕ Added files
14.1/Feature-108344-AllowNumberOfDecimalsInStdWrapbytesFunction.rst
.. include:: /Includes.rst.txt
.. _feature-108344-1764239726:
===================================================================================
Feature: #108344 - Allow number of decimals in :typoscript:`stdWrap.bytes` function
===================================================================================
See :issue:`108344`
Description
===========
The TypoScript function :typoscript:`stdWrap.bytes` now accepts an additional
configuration parameter :typoscript:`decimals`. It allows to explicitly define
the number of decimals in the resulting number representation. By default, the
number of decimals is derived from the formatted size.
In addition, the consumed PHP function
:php:`TYPO3\CMS\Core\Utility\GeneralUtility::formatSize` is extended as well.
The additional parameter :php:`$decimals` is added and defaults to :php:`null`,
which results in the same behavior as for the TypoScript function
:typoscript:`stdWrap.bytes`.
Example
-------
.. code-block:: typoscript
:emphasize-lines: 5
lib.fileSize = TEXT
lib.fileSize {
value = 123456
bytes = 1
bytes.decimals = 1
}
Impact
======
By allowing to configure the number of decimals in :typoscript:`stdWrap.bytes`,
integrators can now better adapt the output of the formatted size returned by
the TypoScript function. This was previously not possible by default and needed
some workarounds in TypoScript.
.. index:: TypoScript, ext:frontend