Sulu\Component\Webspace\Manager\WebspaceManagerInterface::findPortalInformationsByUrl PHP Method

findPortalInformationsByUrl() public method

Returns all portal which matches the given url (which has not necessarily to be the main url).
public findPortalInformationsByUrl ( string $url, string $environment ) : PortalInformation[]
$url string The url to search for
$environment string The environment in which the url should be searched
return Sulu\Component\Webspace\PortalInformation[]
    public function findPortalInformationsByUrl($url, $environment);

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function process(Request $request, RequestAttributes $requestAttributes)
 {
     $url = rtrim(sprintf('%s%s', $request->getHost(), $request->getRequestUri()), '/');
     if (substr($url, -5, 5) === '.html') {
         $url = substr($url, 0, -5);
     }
     $portalInformations = $this->webspaceManager->findPortalInformationsByUrl($url, $this->environment);
     if (count($portalInformations) === 0) {
         return new RequestAttributes();
     }
     /** @var PortalInformation[] $portalInformations */
     $portalInformations = array_filter($portalInformations, function (PortalInformation $portalInformation) {
         return $portalInformation->getType() === RequestAnalyzer::MATCH_TYPE_WILDCARD;
     });
     foreach ($portalInformations as $portalInformation) {
         if (!$portalInformation->getWebspace()) {
             continue;
         }
         if (null !== ($attributes = $this->matchCustomUrl($url, $portalInformation, $request))) {
             return new RequestAttributes($attributes);
         }
     }
     return new RequestAttributes();
 }
All Usage Examples Of Sulu\Component\Webspace\Manager\WebspaceManagerInterface::findPortalInformationsByUrl