Exemplo n.º 1
0
 /**
  * Creates an URI used for linking to an Extbase action.
  * Works in Frontend and Backend mode of TYPO3.
  *
  * @param string $actionName Name of the action to be called
  * @param array $controllerArguments Additional query parameters. Will be "namespaced" and merged with $this->arguments.
  * @param string $controllerName Name of the target controller. If not set, current ControllerName is used.
  * @param string $extensionName Name of the target extension, without underscores. If not set, current ExtensionName is used.
  * @param string $pluginName Name of the target plugin. If not set, current PluginName is used.
  * @return string the rendered URI
  * @api
  * @see build()
  */
 public function uriFor($actionName = NULL, $controllerArguments = array(), $controllerName = NULL, $extensionName = NULL, $pluginName = NULL)
 {
     if ($actionName !== NULL) {
         $controllerArguments['action'] = $actionName;
     }
     if ($controllerName !== NULL) {
         $controllerArguments['controller'] = $controllerName;
     } else {
         $controllerArguments['controller'] = $this->request->getControllerName();
     }
     if ($extensionName === NULL) {
         $extensionName = $this->request->getControllerExtensionName();
     }
     if ($pluginName === NULL && $this->environmentService->isEnvironmentInFrontendMode()) {
         $pluginName = $this->extensionService->getPluginNameByAction($extensionName, $controllerArguments['controller'], $controllerArguments['action']);
     }
     if ($pluginName === NULL) {
         $pluginName = $this->request->getPluginName();
     }
     if ($this->environmentService->isEnvironmentInFrontendMode() && $this->configurationManager->isFeatureEnabled('skipDefaultArguments')) {
         $controllerArguments = $this->removeDefaultControllerAndAction($controllerArguments, $extensionName, $pluginName);
     }
     if ($this->targetPageUid === NULL && $this->environmentService->isEnvironmentInFrontendMode()) {
         $this->targetPageUid = $this->extensionService->getTargetPidByPlugin($extensionName, $pluginName);
     }
     if ($this->format !== '') {
         $controllerArguments['format'] = $this->format;
     }
     if ($this->argumentPrefix !== NULL) {
         $prefixedControllerArguments = array($this->argumentPrefix => $controllerArguments);
     } else {
         $pluginNamespace = $this->extensionService->getPluginNamespace($extensionName, $pluginName);
         $prefixedControllerArguments = array($pluginNamespace => $controllerArguments);
     }
     \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->arguments, $prefixedControllerArguments);
     return $this->build();
 }
Exemplo n.º 2
0
 /**
  * Builds a TypoLink configuration array from the current settings
  *
  * @return array typolink configuration array
  * @see TSref/typolink
  */
 protected function buildTypolinkConfiguration()
 {
     $typolinkConfiguration = array();
     $typolinkConfiguration['parameter'] = $this->targetPageUid !== NULL ? $this->targetPageUid : $GLOBALS['TSFE']->id;
     if ($this->targetPageType !== 0) {
         $typolinkConfiguration['parameter'] .= ',' . $this->targetPageType;
     } elseif ($this->format !== '') {
         $targetPageType = $this->extensionService->getTargetPageTypeByFormat($this->request->getControllerExtensionName(), $this->format);
         $typolinkConfiguration['parameter'] .= ',' . $targetPageType;
     }
     if (count($this->arguments) > 0) {
         $arguments = $this->convertDomainObjectsToIdentityArrays($this->arguments);
         $this->lastArguments = $arguments;
         $typolinkConfiguration['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl(NULL, $arguments);
     }
     if ($this->addQueryString === TRUE) {
         $typolinkConfiguration['addQueryString'] = 1;
         if (count($this->argumentsToBeExcludedFromQueryString) > 0) {
             $typolinkConfiguration['addQueryString.'] = array('exclude' => implode(',', $this->argumentsToBeExcludedFromQueryString));
         }
         if ($this->addQueryStringMethod) {
             $typolinkConfiguration['addQueryString.']['method'] = $this->addQueryStringMethod;
         }
     }
     if ($this->noCache === TRUE) {
         $typolinkConfiguration['no_cache'] = 1;
     } elseif ($this->useCacheHash) {
         $typolinkConfiguration['useCacheHash'] = 1;
     }
     if ($this->section !== '') {
         $typolinkConfiguration['section'] = $this->section;
     }
     if ($this->linkAccessRestrictedPages === TRUE) {
         $typolinkConfiguration['linkAccessRestrictedPages'] = 1;
     }
     return $typolinkConfiguration;
 }
 /**
  * Resolve view and initialize the general view-variables extensionName,
  * controllerName and actionName based on the request object
  *
  * @return \TYPO3\CMS\Fluid\View\TemplateView
  */
 protected function resolveView()
 {
     $view = parent::resolveView();
     $view->assignMultiple(['extensionName' => $this->request->getControllerExtensionName(), 'controllerName' => $this->request->getControllerName(), 'actionName' => $this->request->getControllerActionName()]);
     return $view;
 }