[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Tracker: Fix multilingual text field rendering as item title

"Adrien Mbuya Maloba \(@adrienmaloba\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a3a929dbba4c_381987c847758@gitlab-sidekiq-low-urgency-cpu-bound-v2-66fdbcf897-pmqkg.mail>

Adrien Mbuya Maloba pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
ba29b176 by Landry Bitege at 2026-06-23T16:44:45+03:00
[FIX] Tracker: Fix multilingual text field rendering as item title
---
* [FIX] Tracker: Fix multilingual text field rendering as item title

See merge request tikiwiki/tiki!10542

- - - - -


2 changed files:

- lib/core/Tracker/Field/Text.php
- lib/trackers/trackerlib.php


Changes:

=====================================
lib/core/Tracker/Field/Text.php
=====================================
@@ -175,6 +175,21 @@ class Tracker_Field_Text extends \Tracker\Field\AbstractItemField implements \Tr
         }
     }
 
+    public function renderText($context = [])
+    {
+        $value = $this->getValue();
+
+        if ($this->getConfiguration('isMultilingual') == 'y') {
+            $decoded = json_decode($value, true);
+            if (is_array($decoded)) {
+                $language = Language::getCurrentLanguage();
+                $value = $decoded[$language] ?? (reset($decoded) ?: '');
+            }
+        }
+
+        return trim(strip_tags((string) $value));
+    }
+
     protected function processMultilingual($requestData, $id_string)
     {
         global $prefs;


=====================================
lib/trackers/trackerlib.php
=====================================
@@ -4198,7 +4198,7 @@ class TrackerLib extends TikiLib
                 return $cache[$cacheKey];
             }
         }
-        $query = "SELECT tif.`value`, tf.`type`, tf.`fieldId`, tf.`options`, i.`trackerId`
+        $query = "SELECT tif.`value`, tf.`type`, tf.`fieldId`, tf.`options`, tf.`isMultilingual`, i.`trackerId`
                 FROM `tiki_tracker_item_fields` tif
                 JOIN `tiki_tracker_items` i ON i.`itemId` = tif.`itemId`
                 JOIN `tiki_tracker_fields` tf ON tf.`fieldId` = tif.`fieldId`
@@ -4216,11 +4216,12 @@ class TrackerLib extends TikiLib
         foreach ($queryResult as $row) {
             $value = $row['value'];
             $field = [
-                'fieldId' => $row['fieldId'],
-                'trackerId' => $trackerId,
-                'type' => $row['type'],
-                'options' => $row['options'],
-                'value' => $value
+                'fieldId'        => $row['fieldId'],
+                'trackerId'      => $trackerId,
+                'type'           => $row['type'],
+                'options'        => $row['options'],
+                'isMultilingual' => $row['isMultilingual'],
+                'value'          => $value
             ];
 
             $handler = $this->get_field_handler($field, $item);



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ba29b176d3bd43994e141a8a3cfae3dfb9680392

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ba29b176d3bd43994e141a8a3cfae3dfb9680392
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.