[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [ENH] Sublist: parse wiki argvariables in the sublist wiki content, leave only...

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68e625b870452_2cdffe898786@gitlab-sidekiq-low-urgency-cpu-bound-v2-8b69f8fc4-hggb7.mail>

Victor Emanouilov pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki


Commits:
0a719c2a by Victor Emanouilov at 2025-10-08T11:49:55+03:00
[ENH] Sublist: parse wiki argvariables in the sublist wiki content, leave only specifically formatted fields in the resultset, add sublist results to parent entry when there is only one entry and no reverse mappign is used

- - - - -


2 changed files:

- lib/core/Search/Formatter.php
- lib/core/Search/Formatter/Sublist/Executor.php


Changes:

=====================================
lib/core/Search/Formatter.php
=====================================
@@ -61,7 +61,7 @@ class Search_Formatter
             . $this->render($this->plugin, $list, Search_Formatter_Plugin_Interface::FORMAT_WIKI);
     }
 
-    public function getPopulatedList($list, $preload = true)
+    public function getPopulatedList($list, $preload = true, $onlyPreloaded = false)
     {
         global $prefs;
 
@@ -121,6 +121,10 @@ class Search_Formatter
             }
 
             foreach ($pre as $k => $rawValue) {
+                if ($preload && $onlyPreloaded && ! in_array($k, $fields)) {
+                    continue;
+                }
+
                 $finalValue = null;
 
                 // process multilingual fields


=====================================
lib/core/Search/Formatter/Sublist/Executor.php
=====================================
@@ -182,6 +182,9 @@ class Executor
                 }
             }
         }
+
+        TikiLib::lib('parser')->parse_wiki_argvariable($body);
+
         return $body;
     }
 
@@ -213,7 +216,7 @@ class Executor
         foreach ($this->formatterPlugins as $name => $plugin) {
             $sf->addSubFormatter($name, $plugin);
         }
-        $formatted = $sf->getPopulatedList($result, true);
+        $formatted = $sf->getPopulatedList($result, true, true);
 
         foreach ($formatted as $entry) {
             foreach ($this->reverseMapping as $i => $mappings) {
@@ -261,6 +264,16 @@ class Executor
                     }
                 }
             }
+            // add to a single parent record when no match mapping is set (useful for retrieving records in an aggregate random parent record)
+            if (empty($this->reverseMapping) && count($this->data) == 1 && isset($this->data[0])) {
+                if ($this->record->isMultiple()) {
+                    $arr = $this->data[0][$key] ?? [];
+                    $arr[] = $entry;
+                    $this->data[0][$key] = $arr;
+                } else {
+                    $this->data[0][$key] = $entry;
+                }
+            }
         }
 
         foreach ($this->data as $i => $row) {



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

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0a719c2afe90a5985a0b2078d1925c379d8d6150
You're receiving this email because of your account on gitlab.com.

_______________________________________________
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.