TYPO3 API  SVNRelease
PageViewHelper.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*                                                                        *
00004  * This script is part of the TYPO3 project - inspiring people to share!  *
00005  *                                                                        *
00006  * TYPO3 is free software; you can redistribute it and/or modify it under *
00007  * the terms of the GNU General Public License version 2 as published by  *
00008  * the Free Software Foundation.                                          *
00009  *                                                                        *
00010  * This script is distributed in the hope that it will be useful, but     *
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
00012  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General      *
00013  * Public License for more details.                                       *
00014  *                                                                        */
00015 
00016 /**
00017  * A view helper for creating URIs to TYPO3 pages.
00018  *
00019  * = Examples =
00020  *
00021  * <code title="URI to the current page">
00022  * <f:uri.page>page link</f:uri.page>
00023  * </code>
00024  * <output>
00025  * index.php?id=123
00026  * (depending on the current page and your TS configuration)
00027  * </output>
00028  *
00029  * <code title="query parameters">
00030  * <f:uri.page pageUid="1" additionalParams="{foo: 'bar'}" />
00031  * </code>
00032  * <output>
00033  * index.php?id=1&foo=bar
00034  * (depending on your TS configuration)
00035  * </output>
00036  *
00037  * <code title="query parameters for extensions">
00038  * <f:uri.page pageUid="1" additionalParams="{extension_key: {foo: 'bar'}}" />
00039  * </code>
00040  * <output>
00041  * index.php?id=1&extension_key[foo]=bar
00042  * (depending on your TS configuration)
00043  * </output>
00044  *
00045  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
00046  */
00047 class Tx_Fluid_ViewHelpers_Uri_PageViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
00048 
00049     /**
00050      * @param integer $page target PID
00051      * @param array $additionalParams query parameters to be attached to the resulting URI
00052      * @param integer $pageType type of the target page. See typolink.parameter
00053      * @param boolean $noCache set this to disable caching for the target page. You should not need this.
00054      * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this.
00055      * @param string $section the anchor to be added to the URI
00056      * @param boolean $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.
00057      * @param boolean $absolute If set, the URI of the rendered link is absolute
00058      * @param boolean $addQueryString If set, the current query parameters will be kept in the URI
00059      * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
00060      * @return string Rendered page URI
00061      * @author Bastian Waidelich <bastian@typo3.org>
00062      */
00063     public function render($pageUid = NULL, array $additionalParams = array(), $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $linkAccessRestrictedPages = FALSE, $absolute = FALSE, $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = array()) {
00064         $uriBuilder = $this->controllerContext->getUriBuilder();
00065         $uri = $uriBuilder
00066             ->setTargetPageUid($pageUid)
00067             ->setTargetPageType($pageType)
00068             ->setNoCache($noCache)
00069             ->setUseCacheHash(!$noCacheHash)
00070             ->setSection($section)
00071             ->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
00072             ->setArguments($additionalParams)
00073             ->setCreateAbsoluteUri($absolute)
00074             ->setAddQueryString($addQueryString)
00075             ->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)
00076             ->build();
00077 
00078         return $uri;
00079     }
00080 }
00081 ?>