[TikiWiki-commits] [Git][tikiwiki/tiki][28.x] [ENH] Sublist: add limitfields parameter

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

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


Commits:
33212e38 by Victor Emanouilov at 2025-10-20T22:07:56+03:00
[ENH] Sublist: add limitfields parameter
---
* [ENH] Sublist: add limitfields parameter - when set to 'y', it limits the sublist resultset rows to only formatted columns, so memory could be conserved

See merge request tikiwiki/tiki!8821

- - - - -


3 changed files:

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


Changes:

=====================================
lib/core/Search/Formatter/Sublist/Executor.php
=====================================
@@ -216,7 +216,7 @@ class Executor
         foreach ($this->formatterPlugins as $name => $plugin) {
             $sf->addSubFormatter($name, $plugin);
         }
-        $formatted = $sf->getPopulatedList($result, true, true);
+        $formatted = $sf->getPopulatedList($result, true, $this->record->limitPreloaded());
 
         foreach ($formatted as $entry) {
             foreach ($this->reverseMapping as $i => $mappings) {


=====================================
lib/core/Search/Formatter/Sublist/Parser.php
=====================================
@@ -31,6 +31,7 @@ class Parser
         $record = new Record($args['name'], $this);
         $record->setMultiple(! empty($args['multiple']));
         $record->setRequired(! empty($args['required']));
+        $record->setLimitPreloaded(! empty($args['limitfields']) && $args['limitfields'] === 'y');
 
         // handle nested sublists first
         $sublists = [];


=====================================
lib/core/Search/Formatter/Sublist/Record.php
=====================================
@@ -15,6 +15,7 @@ class Record
     private $key;
     private $multiple;
     private $required;
+    private $limitPreloaded;
     private $body;
     /** Array of Record */
     private array $sublists = [];
@@ -28,6 +29,7 @@ class Record
         $this->key = $key;
         $this->multiple = false;
         $this->required = false;
+        $this->limitPreloaded = false;
         $this->parser = $parser;
         $this->parent = null;
     }
@@ -88,6 +90,16 @@ class Record
         $this->required = $required;
     }
 
+    public function limitPreloaded()
+    {
+        return $this->limitPreloaded;
+    }
+
+    public function setLimitPreloaded($limitPreloaded)
+    {
+        $this->limitPreloaded = $limitPreloaded;
+    }
+
     /**
      * Return a list of filter fields used in sublist blocks
      */



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

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