Xpressengine\Routing\RouteRepository::findByUrlAndSiteKey PHP Method

findByUrlAndSiteKey() public method

Retrieve a route by url segment and site key
public findByUrlAndSiteKey ( string $url, string $siteKey ) : InstanceRoute
$url string first segment of url
$siteKey string site key
return InstanceRoute
    public function findByUrlAndSiteKey($url, $siteKey);

Usage Example

 /**
  * Retrieve a route by url segment and site key
  *
  * @param string $url     first segment of url
  * @param string $siteKey site key
  * @return InstanceRoute
  */
 public function findByUrlAndSiteKey($url, $siteKey)
 {
     if (!isset($this->mapBySiteKey[$siteKey]) || !array_key_exists($url, $this->mapBySiteKey[$siteKey])) {
         if (!($route = $this->repo->findByUrlAndSiteKey($url, $siteKey))) {
             return null;
         }
         $this->setToMap($route);
     }
     return $this->mapBySiteKey[$siteKey][$url];
 }
All Usage Examples Of Xpressengine\Routing\RouteRepository::findByUrlAndSiteKey