[FEATURE] Add API for requestedId 28/36828/3
authorFrederic Gaus <gaus@flagbit.de>
Wed, 11 Feb 2015 13:43:02 +0000 (14:43 +0100)
committerBenjamin Mack <benni@typo3.org>
Sun, 15 Mar 2015 16:53:43 +0000 (17:53 +0100)
Add an API to TypoScriptFrontendController to receive the original
requested ID.

Change-Id: I16a0ce39bd10bc94f47258e60ad4bfa33f6a59ea
Resolves: #52693
Releases: master
Reviewed-on: http://review.typo3.org/36828
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/core/Documentation/Changelog/master/Feature-52693-TSFE-RequestedId.rst [new file with mode: 0644]
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-52693-TSFE-RequestedId.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-52693-TSFE-RequestedId.rst
new file mode 100644 (file)
index 0000000..84fca5b
--- /dev/null
@@ -0,0 +1,10 @@
+================================================
+Feature: #59646 - Add TSFE property $requestedId
+================================================
+
+Description
+===========
+
+A new property within the main TypoScriptFrontendController for the frontend called $requestedId stores
+the information about the page ID which is set before the page ID processing and resolving.
+It is accessiable via ``$TSFE->getRequestedId()``. Also see ``$TSFE->fetch_the_id()`` method.
index cf5b6cc..a030108 100644 (file)
@@ -827,6 +827,13 @@ class TypoScriptFrontendController {
        public $xhtmlDoctype = '';
 
        /**
+        * Originally requested id from the initial $_GET variable
+        *
+        * @var int
+        */
+       protected $requestedId;
+
+       /**
         * Class constructor
         * Takes a number of GET/POST input variable as arguments and stores them internally.
         * The processing of these variables goes on later in this class.
@@ -1400,7 +1407,7 @@ class TypoScriptFrontendController {
                $GLOBALS['TT']->pull();
                $GLOBALS['TT']->push('fetch_the_id rootLine/', '');
                // We store the originally requested id
-               $requestedId = $this->id;
+               $this->requestedId = $this->id;
                $this->getPageAndRootlineWithDomain($this->domainStartPage);
                $GLOBALS['TT']->pull();
                if ($this->pageNotFound && $this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
@@ -4631,4 +4638,13 @@ class TypoScriptFrontendController {
                return $domainData ? $domainData['domainName'] : NULL;
        }
 
+       /**
+        * Fetches the originally requested id, fallsback to $this->id
+        *
+        * @return integer the originally requested page uid
+        * @see fetch_the_id()
+        */
+       public function getRequestedId() {
+               return $this->requestedId ?: $this->id;
+       }
 }