Add renderer for object ids
authorMarcel Werk <burntime@woltlab.com>
Mon, 9 Dec 2024 16:04:32 +0000 (17:04 +0100)
committerMarcel Werk <burntime@woltlab.com>
Mon, 9 Dec 2024 16:04:32 +0000 (17:04 +0100)
wcfsetup/install/files/lib/system/gridView/renderer/ObjectIdColumnRenderer.class.php [new file with mode: 0644]

diff --git a/wcfsetup/install/files/lib/system/gridView/renderer/ObjectIdColumnRenderer.class.php b/wcfsetup/install/files/lib/system/gridView/renderer/ObjectIdColumnRenderer.class.php
new file mode 100644 (file)
index 0000000..d168fe6
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+namespace wcf\system\gridView\renderer;
+
+/**
+ * Formats the content of a column as an object id.
+ *
+ * @author      Marcel Werk
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.2
+ */
+class ObjectIdColumnRenderer extends AbstractColumnRenderer
+{
+    #[\Override]
+    public function render(mixed $value, mixed $context = null): string
+    {
+        return \intval($value);
+    }
+
+    #[\Override]
+    public function getClasses(): string
+    {
+        return 'gridView__column--digits';
+    }
+}