Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomUrlLocator.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
14 {
18  private $urlLocators;
19 
23  public function __construct(array $urlLocators = [])
24  {
25  $this->urlLocators = $urlLocators;
26  }
27 
31  public function locateUrl($urlKey): ?string
32  {
33  foreach ($this->urlLocators as $urlLocator) {
34  $url = $urlLocator->locateUrl($urlKey);
35  if ($url !== null) {
36  return $url;
37  }
38  }
39  return null;
40  }
41 }