‪TYPO3CMS  ‪main
BackendEntryPointResolver.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ServerRequestInterface;
21 use Psr\Http\Message\UriInterface;
24 
29 {
30  protected string ‪$path = 'typo3/';
31 
35  public function ‪getPathFromRequest(ServerRequestInterface $request): string
36  {
37  if ($request->getAttribute('normalizedParams') instanceof ‪NormalizedParams) {
38  $normalizedParams = $request->getAttribute('normalizedParams');
39  } else {
40  $normalizedParams = ‪NormalizedParams::createFromRequest($request);
41  }
42  return $normalizedParams->getSitePath() . ‪$this->path;
43  }
44 
48  public function ‪getUriFromRequest(ServerRequestInterface $request, string $additionalPathPart = ''): UriInterface
49  {
50  if ($request->getAttribute('normalizedParams') instanceof ‪NormalizedParams) {
51  $normalizedParams = $request->getAttribute('normalizedParams');
52  } else {
53  $normalizedParams = ‪NormalizedParams::createFromRequest($request);
54  }
55  return new ‪Uri($normalizedParams->getSiteUrl() . $this->path . ltrim($additionalPathPart, '/'));
56  }
57 }
‪TYPO3\CMS\Core\Routing\BackendEntryPointResolver\getUriFromRequest
‪getUriFromRequest(ServerRequestInterface $request, string $additionalPathPart='')
Definition: BackendEntryPointResolver.php:48
‪TYPO3\CMS\Core\Routing
‪TYPO3\CMS\Core\Http\Uri
Definition: Uri.php:30
‪TYPO3\CMS\Core\Http\NormalizedParams\createFromRequest
‪static static createFromRequest(ServerRequestInterface $request, array $systemConfiguration=null)
Definition: NormalizedParams.php:840
‪TYPO3\CMS\Core\Routing\BackendEntryPointResolver
Definition: BackendEntryPointResolver.php:29
‪TYPO3\CMS\Core\Http\NormalizedParams
Definition: NormalizedParams.php:38
‪TYPO3\CMS\Core\Routing\BackendEntryPointResolver\getPathFromRequest
‪getPathFromRequest(ServerRequestInterface $request)
Definition: BackendEntryPointResolver.php:35
‪TYPO3\CMS\Core\Routing\BackendEntryPointResolver\$path
‪string $path
Definition: BackendEntryPointResolver.php:30