[TikiWiki-commits] [Git][tikiwiki/tiki][26.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 <68e625c375ba7_2cdffc02389b@gitlab-sidekiq-low-urgency-cpu-bound-v2-8b69f8fc4-cmjjn.mail>

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


Commits:
09f0466d by Victor Emanouilov at 2025-10-08T11:50:05+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
=====================================
@@ -60,7 +60,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;
 
@@ -120,6 +120,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
=====================================
@@ -168,6 +168,9 @@ class Executor
                 }
             }
         }
+
+        TikiLib::lib('parser')->parse_wiki_argvariable($body);
+
         return $body;
     }
 
@@ -199,7 +202,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) {
@@ -247,6 +250,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/09f0466d2099c829299f156340f727163bbc7f77

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/09f0466d2099c829299f156340f727163bbc7f77
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.