From 0f6cd3c148f203dcbe01b11cdd051b67a37ac94a Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Thu, 9 Feb 2023 13:55:23 -0500 Subject: [PATCH] Add a session cache for column options, optimization in ProcessPageLister --- .../Process/ProcessPageLister/ProcessPageLister.module | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wire/modules/Process/ProcessPageLister/ProcessPageLister.module b/wire/modules/Process/ProcessPageLister/ProcessPageLister.module index 544168b1..4aa2353c 100644 --- a/wire/modules/Process/ProcessPageLister/ProcessPageLister.module +++ b/wire/modules/Process/ProcessPageLister/ProcessPageLister.module @@ -630,9 +630,14 @@ class ProcessPageLister extends Process implements ConfigurableModule { $value = $input->post('columns'); if($value !== null && $value !== 'ignore' && !in_array('disableColumns', $this->toggles)) { $columns = array(); + $columnOptions = $this->sessionGet('columnOptions'); + if(empty($columnOptions)) { + $columnOptions = $this->buildColumnsField()->getOptions(); + $this->sessionSet('columnOptions', $columnOptions); + } foreach($sanitizer->array($value) as $name) { $name = $sanitizer->name($name); - if(strlen($name)) $columns[] = $name; + if(strlen($name) && isset($columnOptions[$name])) $columns[] = $name; } if(count($columns)) { $this->sessionSet('columns', $columns);