[TikiWiki-commits] [Git][tikiwiki/tiki][master] [ENH] Sublist: parse wiki argvariables, trim resultset, matchless parent

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

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
d8a7821a by Victor Emanouilov at 2025-10-08T08:41:23+00:00
[ENH] Sublist: parse wiki argvariables, trim resultset, matchless parent
---
* [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

See merge request tikiwiki/tiki!8735

- - - - -


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/d8a7821aa6930e97710f32be1217ba31a109cc3b

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