[TASK] Remember search filter in PageModule 20/35420/2
authorFrank Nägler <typo3@naegler.net>
Sun, 14 Dec 2014 15:18:49 +0000 (16:18 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 14 Dec 2014 16:02:37 +0000 (17:02 +0100)
Bring session handling for search field also to the
PageModule. Now it works like in the ListModule.

Resolves: #63841
Related: #33627
Releases: master
Change-Id: I8ad351b73259345f406d29747a250cd3acd7f3d4
Reviewed-on: http://review.typo3.org/35420
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Controller/PageLayoutController.php

index 8b0d468..1ba40b2 100644 (file)
@@ -258,6 +258,9 @@ class PageLayoutController {
                $this->MCONF = $GLOBALS['MCONF'];
                $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
                $this->backPath = $GLOBALS['BACK_PATH'];
+               // Get session data
+               $sessionData = $GLOBALS['BE_USER']->getSessionData(\TYPO3\CMS\Recordlist\RecordList::class);
+               $this->search_field = !empty($sessionData['search_field']) ? $sessionData['search_field'] : '';
                // GPvars:
                $this->id = (int)GeneralUtility::_GP('id');
                $this->pointer = GeneralUtility::_GP('pointer');
@@ -266,11 +269,20 @@ class PageLayoutController {
                $this->popView = GeneralUtility::_GP('popView');
                $this->edit_record = GeneralUtility::_GP('edit_record');
                $this->new_unique_uid = GeneralUtility::_GP('new_unique_uid');
-               $this->search_field = GeneralUtility::_GP('search_field');
+               if (!empty(GeneralUtility::_GP('search_field'))) {
+                       $this->search_field = GeneralUtility::_GP('search_field');
+                       $sessionData['search_field'] = $this->search_field;
+               }
                $this->search_levels = GeneralUtility::_GP('search_levels');
                $this->showLimit = GeneralUtility::_GP('showLimit');
                $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
                $this->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
+               if (!empty(GeneralUtility::_GP('search')) && empty(GeneralUtility::_GP('search_field'))) {
+                       $this->search_field = '';
+                       $sessionData['search_field'] = $this->search_field;
+               }
+               // Store session data
+               $GLOBALS['BE_USER']->setAndSaveSessionData(\TYPO3\CMS\Recordlist\RecordList::class, $sessionData);
                // Load page info array:
                $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
                // Initialize menu