[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX] Tracker: Item view title rendering when using certain field types as main field
"luci \(@luciash\) via TikiWiki-cvs" <[email protected]> Tue, 30 Jun 2026 14:33:28 +0000
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a43d3b8a6406_3810c10538589b4@gitlab-sidekiq-low-urgency-cpu-bound-v2-656d6f88d7-9d8r9.mail> |
luci pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki
Commits:
7f1f210e by Landry Bitege at 2026-06-30T14:24:42+00:00
[BP][FIX] Tracker: Item view title rendering when using certain field types as main field
---
* [BP][FIX] Tracker: Item view title rendering when using certain field types as main field
---
* [FIX] Tracker: Item view title rendering when using certain field types as main field
---
* [FIX] Tracker: Item view title rendering when using certain field types as main field
See merge request tikiwiki/tiki!9836
(cherry picked from commit d87ab249a3acd9ab559964ec227ef7bcadc74774)
See merge request tikiwiki/tiki!10596
(cherry picked from commit c3d23c391ed2673cafea4e64c594d5db3d12cc72)
See merge request tikiwiki/tiki!10616
- - - - -
12 changed files:
- lib/core/Tracker/Field/AbstractItemField.php
- lib/core/Tracker/Field/BarCode.php
- lib/core/Tracker/Field/Category.php
- lib/core/Tracker/Field/Checkbox.php
- lib/core/Tracker/Field/CountrySelector.php
- lib/core/Tracker/Field/Dropdown.php
- lib/core/Tracker/Field/EmailFolder.php
- lib/core/Tracker/Field/Files.php
- lib/core/Tracker/Field/Heading.php
- lib/core/Tracker/Field/Language.php
- lib/core/Tracker/Field/Wiki.php
- lib/trackers/trackerlib.php
Changes:
=====================================
lib/core/Tracker/Field/AbstractItemField.php
=====================================
@@ -713,4 +713,22 @@ abstract class AbstractItemField implements ItemFieldInterface, IndexableInterfa
// Specific field types can override this behavior.
return true;
}
+
+ /**
+ * Return a plain text representation of the field value
+ * Intended for simple contexts like titles (isMain)
+ *
+ * @param array $context
+ * @return string
+ */
+ public function renderText($context = [])
+ {
+ $out = $this->renderInnerOutput($context);
+
+ if (is_array($out)) {
+ $out = implode(', ', $out);
+ }
+
+ return trim(strip_tags((string) $out));
+ }
}
=====================================
lib/core/Tracker/Field/BarCode.php
=====================================
@@ -167,4 +167,17 @@ class Tracker_Field_BarCode extends Tracker_Field_Text
}
return true;
}
+
+ /**
+ * Return a plain text representation of the barcode
+ *
+ * @param array $context
+ * @return string
+ */
+ public function renderText($context = [])
+ {
+ $data = $this->getValueAndFormat($this->getValue());
+
+ return isset($data['value']) ? (string) $data['value'] : '';
+ }
}
=====================================
lib/core/Tracker/Field/Category.php
=====================================
@@ -348,6 +348,36 @@ class Tracker_Field_Category extends \Tracker\Field\AbstractItemField implements
}
}
+ /**
+ * Return plain text representation of selected categories
+ *
+ * @param array $context
+ * @return string
+ */
+ public function renderText($context = [])
+ {
+ $data = $this->getFieldData();
+ $selected_categories = $data['selected_categories'];
+ $categories = $data['list'];
+
+ if (! is_array($selected_categories)) {
+ $selected_categories = [];
+ }
+ if (! is_array($categories)) {
+ $categories = [];
+ }
+ $out = [];
+ foreach ($categories as $category) {
+ foreach ($selected_categories as $categId) {
+ if ($category['categId'] == $categId) {
+ $out[] = $category['name'];
+ }
+ }
+ }
+
+ return implode(', ', $out);
+ }
+
public function handleSave($value, $oldValue)
{
if (is_array($value) && isset($value['incremental'])) {
=====================================
lib/core/Tracker/Field/Checkbox.php
=====================================
@@ -94,6 +94,26 @@ class Tracker_Field_Checkbox extends \Tracker\Field\AbstractItemField implements
}
}
+ /**
+ * Return plain text representation of checkbox
+ *
+ * @param array $context
+ * @return string
+ */
+ public function renderText($context = [])
+ {
+ $fieldData = $this->getFieldData();
+ $value = $fieldData['value'] ?? '';
+
+ if ($value === 'y') {
+ return tra('Yes');
+ } elseif ($value === 'n') {
+ return tra('No');
+ } else {
+ return $value;
+ }
+ }
+
public function getDocumentPart(Search_Type_Factory_Interface $typeFactory)
{
$baseKey = $this->getBaseKey();
=====================================
lib/core/Tracker/Field/CountrySelector.php
=====================================
@@ -188,13 +188,14 @@ class Tracker_Field_CountrySelector extends \Tracker\Field\AbstractItemField imp
}
foreach ($current as $index => $value) {
- $label = $flags[$value];
+ $label = $flags[$value] ?? '';
+
if ($context['list_mode'] != 'csv') {
if ($this->getOption('name_flag') != 1) {
$out .= $this->renderImage($value, $label);
}
if ($this->getOption('name_flag') == 0) {
- $out .= ' ';
+ $out .= ' ';
}
}
$out .= $label;
@@ -206,6 +207,23 @@ class Tracker_Field_CountrySelector extends \Tracker\Field\AbstractItemField imp
return $out;
}
+ /**
+ * Return plain text representation of selected countries
+ *
+ * @param array $context
+ * @return string
+ */
+ public function renderText($context = [])
+ {
+ $current = $this->getConfiguration('value');
+
+ if (empty($current)) {
+ return '';
+ }
+
+ return $current;
+ }
+
private function renderImage($code, $label)
{
$smarty = TikiLib::lib('smarty');
=====================================
lib/core/Tracker/Field/Dropdown.php
=====================================
@@ -214,6 +214,29 @@ class Tracker_Field_Dropdown extends \Tracker\Field\AbstractItemField implements
}
}
+ /**
+ * Return plain text representation of selected option(s)
+ *
+ * @param array $context
+ * @return string
+ */
+ public function renderText($context = [])
+ {
+ $data = $this->getFieldData();
+ $selected = $data['selected'];
+
+ if (! is_array($selected)) {
+ $selected = [];
+ }
+
+ if (! empty($context['list_mode']) && $context['list_mode'] === 'csv') {
+ return implode(', ', $selected);
+ } else {
+ $labels = array_map([$this, 'getValueLabel'], $selected);
+ return implode(', ', $labels);
+ }
+ }
+
private function getValueLabel($value)
{
$possibilities = $this->getPossibleItemValues();
=====================================
lib/core/Tracker/Field/EmailFolder.php
=====================================
@@ -324,6 +324,28 @@ class Tracker_Field_EmailFolder extends Tracker_Field_Files implements \Tracker\
]);
}
+ /**
+ * Return a plain text
+ * Intended for simple contexts like titles (isMain)
+ *
+ * @param array $context
+ * @return string
+ */
+ public function renderText($context = [])
+ {
+ $emails = $this->getConfiguration('emails');
+ $output = "";
+ foreach ($this->getFolders() as $folder => $folderName) {
+ if (! empty($emails[$folder])) {
+ $output .= $folderName . ":\n";
+ foreach ($emails[$folder] as $email) {
+ $output .= "- " . $email['subject'] . "\n";
+ }
+ }
+ }
+ return $output;
+ }
+
public function handleSave($value, $oldValue)
{
$existing = json_decode($oldValue, true);
=====================================
lib/core/Tracker/Field/Files.php
=====================================
@@ -453,7 +453,6 @@ class Tracker_Field_Files extends \Tracker\Field\AbstractItemField implements \T
global $mimetypes;
global $tikipath;
-
include('lib/mime/mimetypes.php');
$galleryId = (int)$this->getOption('galleryId');
@@ -661,6 +660,25 @@ class Tracker_Field_Files extends \Tracker\Field\AbstractItemField implements \T
return $ret;
}
+ /**
+ * Render the field as plain text
+ *
+ * @param array $context
+ * @return string
+ */
+ public function renderText($context = [])
+ {
+ $value = $this->getValue();
+ if (empty($value)) {
+ return '';
+ }
+ $fileIds = array_filter(explode(',', $value));
+ $fileInfo = $this->getFileInfo($fileIds);
+ return implode(', ', array_map(function ($file) {
+ return $file['name'];
+ }, $fileInfo));
+ }
+
private function isMimeType(array $mimes, string $fileType, array $extensions): bool
{
foreach ($extensions as $ext) {
=====================================
lib/core/Tracker/Field/Heading.php
=====================================
@@ -63,7 +63,7 @@ class Tracker_Field_Heading extends \Tracker\Field\AbstractItemField implements
public function renderOutput($context = [])
{
if (isset($context['list_mode']) && $context['list_mode'] === 'csv') {
- return;
+ return "";
}
global $prefs;
$headerlib = TikiLib::lib('header');
@@ -134,6 +134,11 @@ class Tracker_Field_Heading extends \Tracker\Field\AbstractItemField implements
return $html;
}
+ public function renderText($context = [])
+ {
+ return tra($this->getConfiguration('name'));
+ }
+
public function importRemote($value)
{
return '';
=====================================
lib/core/Tracker/Field/Language.php
=====================================
@@ -79,6 +79,13 @@ class Tracker_Field_Language extends \Tracker\Field\AbstractItemField implements
);
}
+ public function renderText($context = [])
+ {
+ $selected = $this->getConfiguration('value');
+ $languages = $this->getLanguages();
+ return $languages[$selected] ?? tr('None');
+ }
+
public function handleSave($value, $oldValue)
{
return [
=====================================
lib/core/Tracker/Field/Wiki.php
=====================================
@@ -363,6 +363,17 @@ class Tracker_Field_Wiki extends Tracker_Field_Text implements \Tracker\Field\Ex
return $this->attemptParse($this->getConfiguration('page_data'));
}
+ /**
+ * Render the field value as plain text.
+ * @param mixed $context
+ * @return string
+ */
+ public function renderText($context = [])
+ {
+ $data = $this->getFieldData();
+ return $this->attemptParse($data['page_data']);
+ }
+
public function getDocumentPart(Search_Type_Factory_Interface $typeFactory)
{
$data = [];
=====================================
lib/trackers/trackerlib.php
=====================================
@@ -4272,7 +4272,10 @@ class TrackerLib extends TikiLib
$handler = $this->get_field_handler($field, $item);
if ($handler) {
- $value = $handler->renderOutput(['list_mode' => 'y', 'isMain_context' => true]);
+ $value = $handler->renderText([
+ 'list_mode' => 'y',
+ 'isMain_context' => true
+ ]);
}
if (! empty($value)) {
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7f1f210e73d738e0878b0dfd3ef30946336b7132
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7f1f210e73d738e0878b0dfd3ef30946336b7132
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