File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
wcfsetup/install/files/lib/system/gridView/renderer Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace wcf \system \gridView \renderer ;
4+
5+ use wcf \system \WCF ;
6+ use wcf \util \StringUtil ;
7+
8+ /**
9+ * Formats the content of a column as a currency.
10+ *
11+ * @author Marcel Werk
12+ * @copyright 2001-2024 WoltLab GmbH
13+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14+ * @since 6.2
15+ */
16+ class CurrencyColumnRenderer extends AbstractColumnRenderer
17+ {
18+ public function __construct (
19+ private readonly string $ currency ,
20+ ) {}
21+
22+ #[\Override]
23+ public function render (mixed $ value , mixed $ context = null ): string
24+ {
25+ return \number_format (
26+ \round ($ value , 2 ),
27+ 2 ,
28+ WCF ::getLanguage ()->get ('wcf.global.decimalPoint ' ),
29+ WCF ::getLanguage ()->get ('wcf.global.thousandsSeparator ' )
30+ ) . ' ' . StringUtil::encodeHTML ($ this ->currency );
31+ }
32+
33+ #[\Override]
34+ public function getClasses (): string
35+ {
36+ return 'gridView__column--digits ' ;
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments