TYPO3 CMS  TYPO3_7-6
PageViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is part of the TYPO3 project - inspiring people to share! *
6  * *
7  * TYPO3 is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU General Public License version 2 as published by *
9  * the Free Software Foundation. *
10  * *
11  * This script is distributed in the hope that it will be useful, but *
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
13  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
14  * Public License for more details. *
15  * */
46 {
50  protected $tagName = 'a';
51 
57  public function initializeArguments()
58  {
60  $this->registerTagAttribute('target', 'string', 'Target of link', false);
61  $this->registerTagAttribute('rel', 'string', 'Specifies the relationship between the current document and the linked document', false);
62  }
63 
78  public function render($pageUid = null, array $additionalParams = [], $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $linkAccessRestrictedPages = false, $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = [], $addQueryStringMethod = null)
79  {
80  $uriBuilder = $this->controllerContext->getUriBuilder();
81  $uri = $uriBuilder->reset()
82  ->setTargetPageUid($pageUid)
83  ->setTargetPageType($pageType)
84  ->setNoCache($noCache)
85  ->setUseCacheHash(!$noCacheHash)
86  ->setSection($section)
87  ->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
88  ->setArguments($additionalParams)
89  ->setCreateAbsoluteUri($absolute)
90  ->setAddQueryString($addQueryString)
91  ->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)
92  ->setAddQueryStringMethod($addQueryStringMethod)
93  ->build();
94  if ((string)$uri !== '') {
95  $this->tag->addAttribute('href', $uri);
96  $this->tag->setContent($this->renderChildren());
97  $result = $this->tag->render();
98  } else {
99  $result = $this->renderChildren();
100  }
101  return $result;
102  }
103 }
registerTagAttribute($name, $type, $description, $required=false, $default=null)