TYPO3 API  SVNRelease
ActionViewHelper.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 extbase actions.
00018  *
00019  * = Examples =
00020  *
00021  * <code title="URI to the show-action of the current controller">
00022  * <f:uri.action action="show" />
00023  * </code>
00024  * <output>
00025  * index.php?id=123&tx_myextension_plugin[action]=show&tx_myextension_plugin[controller]=Standard&cHash=xyz
00026  * (depending on the current page and your TS configuration)
00027  * </output>
00028  *
00029  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
00030  *
00031  */
00032 class Tx_Fluid_ViewHelpers_Uri_ActionViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
00033 
00034     /**
00035      * @param string $action Target action
00036      * @param array $arguments Arguments
00037      * @param string $controller Target controller. If NULL current controllerName is used
00038      * @param string $extensionName Target Extension Name (without "tx_" prefix and no underscores). If NULL the current extension name is used
00039      * @param string $pluginName Target plugin. If empty, the current plugin name is used
00040      * @param integer $pageUid target page. See TypoLink destination
00041      * @param integer $pageType type of the target page. See typolink.parameter
00042      * @param boolean $noCache set this to disable caching for the target page. You should not need this.
00043      * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this.
00044      * @param string $section the anchor to be added to the URI
00045      * @param string $format The requested format, e.g. ".html"
00046      * @param boolean $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.
00047      * @param array $additionalParams additional query parameters that won't be prefixed like $arguments (overrule $arguments)
00048      * @param boolean $absolute If set, an absolute URI is rendered
00049      * @param boolean $addQueryString If set, the current query parameters will be kept in the URI
00050      * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
00051      * @return string Rendered link
00052      * @author Sebastian Kurfürst <sebastian@typo3.org>
00053      * @author Bastian Waidelich <bastian@typo3.org>
00054      */
00055     public function render($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $pageUid = NULL, $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $format = '', $linkAccessRestrictedPages = FALSE, array $additionalParams = array(), $absolute = FALSE, $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = array()) {
00056         $uriBuilder = $this->controllerContext->getUriBuilder();
00057         $uri = $uriBuilder
00058             ->reset()
00059             ->setTargetPageUid($pageUid)
00060             ->setTargetPageType($pageType)
00061             ->setNoCache($noCache)
00062             ->setUseCacheHash(!$noCacheHash)
00063             ->setSection($section)
00064             ->setFormat($format)
00065             ->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
00066             ->setArguments($additionalParams)
00067             ->setCreateAbsoluteUri($absolute)
00068             ->setAddQueryString($addQueryString)
00069             ->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)
00070             ->uriFor($action, $arguments, $controller, $extensionName, $pluginName);
00071 
00072         return $uri;
00073     }
00074 }
00075 ?>