2 namespace TYPO3\CMS\Extbase\Mvc\Web\Routing;
164 $this->contentObject = $this->configurationManager->getContentObject();
521 $this->arguments = array();
524 $this->createAbsoluteUri =
false;
525 $this->addQueryString =
false;
526 $this->addQueryStringMethod = null;
527 $this->argumentsToBeExcludedFromQueryString = array();
528 $this->linkAccessRestrictedPages =
false;
529 $this->targetPageUid = null;
530 $this->targetPageType = 0;
531 $this->noCache =
false;
532 $this->useCacheHash =
true;
533 $this->argumentPrefix = null;
550 public function uriFor($actionName = null, $controllerArguments = array(), $controllerName = null, $extensionName = null, $pluginName = null)
552 if ($actionName !== null) {
553 $controllerArguments[
'action'] = $actionName;
555 if ($controllerName !== null) {
556 $controllerArguments[
'controller'] = $controllerName;
558 $controllerArguments[
'controller'] = $this->request->getControllerName();
560 if ($extensionName === null) {
561 $extensionName = $this->request->getControllerExtensionName();
563 if ($pluginName === null && $this->environmentService->isEnvironmentInFrontendMode()) {
564 $pluginName = $this->extensionService->getPluginNameByAction($extensionName, $controllerArguments[
'controller'], $controllerArguments[
'action']);
566 if ($pluginName === null) {
567 $pluginName = $this->request->getPluginName();
569 if ($this->environmentService->isEnvironmentInFrontendMode() && $this->configurationManager->isFeatureEnabled(
'skipDefaultArguments')) {
572 if ($this->targetPageUid === null && $this->environmentService->isEnvironmentInFrontendMode()) {
573 $this->targetPageUid = $this->extensionService->getTargetPidByPlugin($extensionName, $pluginName);
575 if ($this->format !==
'') {
578 if ($this->argumentPrefix !== null) {
579 $prefixedControllerArguments = array($this->argumentPrefix => $controllerArguments);
581 $pluginNamespace = $this->extensionService->getPluginNamespace($extensionName, $pluginName);
582 $prefixedControllerArguments = array($pluginNamespace => $controllerArguments);
585 return $this->
build();
601 $defaultControllerName = $this->extensionService->getDefaultControllerNameByPlugin($extensionName, $pluginName);
602 if (isset($controllerArguments[
'action'])) {
603 $defaultActionName = $this->extensionService->getDefaultActionNameByPluginAndController($extensionName, $pluginName, $controllerArguments[
'controller']);
604 if ($controllerArguments[
'action'] === $defaultActionName) {
605 unset($controllerArguments[
'action']);
608 if ($controllerArguments[
'controller'] === $defaultControllerName) {
609 unset($controllerArguments[
'controller']);
611 return $controllerArguments;
625 if ($this->environmentService->isEnvironmentInBackendMode()) {
642 if ($this->addQueryString ===
true) {
643 if ($this->addQueryStringMethod) {
644 switch ($this->addQueryStringMethod) {
663 foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) {
679 if ($this->request instanceof WebRequest && $this->createAbsoluteUri) {
680 $uri = (string)$backendUriBuilder->buildUriFromModule($moduleName,
$arguments, \TYPO3\CMS\Backend\Routing\UriBuilder::ABSOLUTE_URL);
682 $uri = (string)$backendUriBuilder->buildUriFromModule($moduleName,
$arguments);
684 if ($this->section !==
'') {
699 if ($this->createAbsoluteUri ===
true) {
700 $typolinkConfiguration[
'forceAbsoluteUrl'] =
true;
701 if ($this->absoluteUriScheme !== null) {
705 $uri = $this->contentObject->typoLink_URL($typolinkConfiguration);
717 $typolinkConfiguration = array();
718 $typolinkConfiguration[
'parameter'] = $this->targetPageUid !== null ? $this->targetPageUid :
$GLOBALS[
'TSFE']->id;
719 if ($this->targetPageType !== 0) {
721 }
elseif ($this->format !==
'') {
725 if (!empty($this->arguments)) {
730 if ($this->addQueryString ===
true) {
731 $typolinkConfiguration[
'addQueryString'] = 1;
732 if (!empty($this->argumentsToBeExcludedFromQueryString)) {
733 $typolinkConfiguration[
'addQueryString.'] = array(
734 'exclude' => implode(
',', $this->argumentsToBeExcludedFromQueryString)
737 if ($this->addQueryStringMethod) {
741 if ($this->noCache ===
true) {
742 $typolinkConfiguration[
'no_cache'] = 1;
743 }
elseif ($this->useCacheHash) {
744 $typolinkConfiguration[
'useCacheHash'] = 1;
746 if ($this->section !==
'') {
749 if ($this->linkAccessRestrictedPages ===
true) {
750 $typolinkConfiguration[
'linkAccessRestrictedPages'] = 1;
752 return $typolinkConfiguration;
765 foreach ($arguments as $argumentKey => $argumentValue) {
767 if ($argumentValue instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
768 $argumentValue = $argumentValue->_loadRealInstance();
771 $arguments[$argumentKey] = $argumentValue;
773 if ($argumentValue instanceof \Iterator) {
776 if ($argumentValue instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject) {
777 if ($argumentValue->getUid() !== null) {
778 $arguments[$argumentKey] = $argumentValue->getUid();
779 }
elseif ($argumentValue instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject) {
782 throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentValueException(
'Could not serialize Domain Object ' . get_class($argumentValue) .
'. It is neither an Entity with identity properties set, nor a Value Object.', 1260881688);
784 }
elseif (is_array($argumentValue)) {
797 if (method_exists($iterator,
'toArray')) {
798 $array = $iterator->toArray();
800 $array = iterator_to_array($iterator);
815 foreach ($object->_getProperties() as $propertyName => $propertyValue) {
816 if ($propertyValue instanceof \Iterator) {
819 if ($propertyValue instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject) {
820 if ($propertyValue->getUid() !== null) {
821 $result[$propertyName] = $propertyValue->getUid();
825 }
elseif (is_array($propertyValue)) {
828 $result[$propertyName] = $propertyValue;