mirror of
https://github.com/processwire/processwire.git
synced 2025-08-11 09:14:58 +02:00
Minor adjustments in ProcessPageLister.module
This commit is contained in:
@@ -159,6 +159,7 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
if(!$this->wire('page')) return;
|
if(!$this->wire('page')) return;
|
||||||
|
|
||||||
$this->defaultColumns = array('title', 'template', 'parent', 'modified', 'modified_users_id');
|
$this->defaultColumns = array('title', 'template', 'parent', 'modified', 'modified_users_id');
|
||||||
@@ -539,20 +540,26 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
*/
|
*/
|
||||||
public function sessionSet($key, $value) {
|
public function sessionSet($key, $value) {
|
||||||
$key = $this->page->name . '_lister_' . $key;
|
$key = $this->page->name . '_lister_' . $key;
|
||||||
if(is_null($value)) $this->session->remove($key);
|
if(is_null($value)) {
|
||||||
else $this->session->set($key, $value);
|
$this->session->remove($key);
|
||||||
|
} else {
|
||||||
|
$this->session->set($key, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a Lister session variable
|
* Get a Lister session variable
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
|
* @param array|string|int $fallback Optional fallback value if session value not present
|
||||||
* @return string|int|array|null
|
* @return string|int|array|null
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function sessionGet($key) {
|
public function sessionGet($key, $fallback = null) {
|
||||||
$key = $this->page->name . '_lister_' . $key;
|
$key = $this->page->name . '_lister_' . $key;
|
||||||
return $this->session->get($key);
|
$value = $this->session->get($key);
|
||||||
|
if($value === null && $fallback !== null) $value = $fallback;
|
||||||
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2027,9 +2034,9 @@ class ProcessPageLister extends Process implements ConfigurableModule {
|
|||||||
$script = '';
|
$script = '';
|
||||||
$regex = '!(Inputfield|Language|Fieldtype|Process|Markup|Jquery)!';
|
$regex = '!(Inputfield|Language|Fieldtype|Process|Markup|Jquery)!';
|
||||||
$scriptClose = '';
|
$scriptClose = '';
|
||||||
$loadedFiles = $this->sessionGet('loadedFiles');
|
$loadedFiles = $this->sessionGet('loadedFiles', array());
|
||||||
$loadedFilesAdd = array();
|
$loadedFilesAdd = array();
|
||||||
$loadedJSConfig = $this->sessionGet('loadedJSConfig');
|
$loadedJSConfig = $this->sessionGet('loadedJSConfig', array());
|
||||||
$config = $this->wire('config');
|
$config = $this->wire('config');
|
||||||
|
|
||||||
foreach($config->scripts as $file) {
|
foreach($config->scripts as $file) {
|
||||||
|
Reference in New Issue
Block a user