getResourceLocatorPrefix() public method

Returns the prefix required before the resource locator.
public getResourceLocatorPrefix ( ) : string
return string
示例#1
0
 /**
  * Prefix url of document with current resourcelocator prefix.
  *
  * @param HitEvent $event
  */
 public function onHit(HitEvent $event)
 {
     if (false === $event->getMetadata()->reflection->isSubclassOf('Sulu\\Bundle\\ContentBundle\\Document\\BasePageDocument')) {
         return;
     }
     $document = $event->getHit()->getDocument();
     $url = sprintf('%s/%s', rtrim($this->requestAnalyzer->getResourceLocatorPrefix(), '/'), ltrim($document->getUrl(), '/'));
     $document->setUrl($url);
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function getContentRootPath($full = false)
 {
     if ($this->requestAnalyzer !== null) {
         if ($full) {
             return $this->requestAnalyzer->getPortalUrl();
         } else {
             return $this->requestAnalyzer->getResourceLocatorPrefix();
         }
     } else {
         return '/';
     }
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function resolve(RequestAnalyzerInterface $requestAnalyzer)
 {
     // determine default locale (if one exists)
     $defaultLocalization = $requestAnalyzer->getPortal()->getDefaultLocalization();
     $defaultLocale = $defaultLocalization ? $defaultLocalization->getLocalization() : null;
     return ['request' => ['webspaceKey' => $requestAnalyzer->getWebspace()->getKey(), 'defaultLocale' => $defaultLocale, 'locale' => $requestAnalyzer->getCurrentLocalization()->getLocalization(), 'portalUrl' => $requestAnalyzer->getPortalUrl(), 'resourceLocatorPrefix' => $requestAnalyzer->getResourceLocatorPrefix(), 'resourceLocator' => $requestAnalyzer->getResourceLocator(), 'get' => $requestAnalyzer->getGetParameters(), 'post' => $requestAnalyzer->getPostParameters(), 'analyticsKey' => $requestAnalyzer->getAnalyticsKey()]];
 }
示例#4
0
 /**
  * Will create a symfony route.
  *
  * @param RouteInterface $route
  * @param Request $request
  *
  * @return Route
  */
 protected function createRoute(RouteInterface $route, Request $request)
 {
     $routePath = $this->requestAnalyzer->getResourceLocatorPrefix() . $route->getPath();
     if ($route->isHistory()) {
         return new Route($routePath, ['_controller' => 'SuluWebsiteBundle:Redirect:redirect', 'url' => $request->getSchemeAndHttpHost() . $this->requestAnalyzer->getResourceLocatorPrefix() . $route->getTarget()->getPath() . ($request->getQueryString() ? '?' . $request->getQueryString() : '')]);
     }
     $symfonyRoute = $this->proxyFactory->createProxy(Route::class, function (&$wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, &$initializer) use($routePath, $route, $request) {
         $initializer = null;
         // disable initialization
         $wrappedObject = new Route($routePath, $this->routeDefaultsProvider->getByEntity($route->getEntityClass(), $route->getEntityId(), $request->getLocale()));
         return true;
     });
     return $this->symfonyRouteCache[$route->getId()] = $symfonyRoute;
 }
示例#5
0
 /**
  * @param $resourceLocator
  *
  * @return string
  */
 protected function getUrlWithoutEndingTrailingSlash($resourceLocator)
 {
     return rtrim($this->requestAnalyzer->getResourceLocatorPrefix() . ($resourceLocator ? $resourceLocator : '/'), '/');
 }