mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 09:44:38 +02:00
Add a session cache for column options, optimization in ProcessPageLister
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user