[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / documentation / Classes / ViewHelpers / Link / ActionViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Documentation\ViewHelpers\Link;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * A view helper for creating links to extbase actions using the loading mask.
19 *
20 * = Examples =
21 *
22 * <code title="link to the show-action of the current controller">
23 * <d:link.action action="show">action link</d:link.action>
24 * </code>
25 * <output>
26 * <a href="#" onclick="top.TYPO3.Backend.ContentContainer.setUrl('index.php?id=123&tx_myextension_plugin[action]=show&tx_myextension_plugin[controller]=Standard&cHash=xyz')">action link</a>
27 * (depending on the current page and your TS configuration)
28 * </output>
29 */
30 class ActionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\ActionViewHelper {
31
32 /**
33 * Renders the extbase action link.
34 *
35 * @param string $action Target action
36 * @param array $arguments Arguments
37 * @param string $controller Target controller. If NULL current controllerName is used
38 * @param string $extensionName Target Extension Name (without "tx_" prefix and no underscores). If NULL the current extension name is used
39 * @param string $pluginName Target plugin. If empty, the current plugin name is used
40 * @param integer $pageUid target page. See TypoLink destination
41 * @param integer $pageType type of the target page. See typolink.parameter
42 * @param boolean $noCache set this to disable caching for the target page. You should not need this.
43 * @param boolean $noCacheHash set this to suppress the cHash query parameter created by TypoLink. You should not need this.
44 * @param string $section the anchor to be added to the URI
45 * @param string $format The requested format, e.g. ".html
46 * @param boolean $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.
47 * @param array $additionalParams additional query parameters that won't be prefixed like $arguments (overrule $arguments)
48 * @param boolean $absolute If set, the URI of the rendered link is absolute
49 * @param boolean $addQueryString If set, the current query parameters will be kept in the URI
50 * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
51 * @return string Rendered link
52 */
53 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()) {
54 $uriBuilder = $this->controllerContext->getUriBuilder();
55 $uri = $uriBuilder
56 ->reset()
57 ->setTargetPageUid($pageUid)
58 ->setTargetPageType($pageType)
59 ->setNoCache($noCache)
60 ->setUseCacheHash(!$noCacheHash)
61 ->setSection($section)
62 ->setFormat($format)
63 ->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
64 ->setArguments($additionalParams)
65 ->setCreateAbsoluteUri($absolute)
66 ->setAddQueryString($addQueryString)
67 ->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)
68 ->uriFor($action, $arguments, $controller, $extensionName, $pluginName);
69
70 $this->tag->addAttribute('href', '#');
71 $this->tag->addAttribute('onclick', 'top.TYPO3.Backend.ContentContainer.setUrl(\'' . $uri . '\')');
72 $this->tag->setContent($this->renderChildren());
73 $this->tag->forceClosingTag(TRUE);
74 return $this->tag->render();
75 }
76 }