/**
  * @inheritdoc
  */
 public function build(Url $url, UrlBuilder $urlBuilder)
 {
     $lang = $urlBuilder->useParameter('lang');
     if (!empty($lang)) {
         if ($lang != $this->defaultLanguage) {
             $url->setPath('/' . $lang . $url->getPath());
         }
     }
 }
예제 #2
0
 /**
  * @inheritdoc
  */
 public function build(Url $url, UrlBuilder $urlBuilder)
 {
     $domain = $urlBuilder->useParameter('_domain');
     $url->setHost($domain);
     $isMobile = $urlBuilder->useParameter('_isMobile');
     if ($isMobile === true) {
         $url->setHost('m.' . $url->getHost());
     }
     if ($devBranch = $urlBuilder->useParameter('_devBranch')) {
         $url->setHost($devBranch . '.debug.' . $url->getHost());
     }
     parent::build($url, $urlBuilder);
 }
예제 #3
0
 /**
  * @inheritdoc
  */
 public function build(Url $url, UrlBuilder $urlBuilder)
 {
     $url->setHost('admin.example.com');
     $parts = [];
     $action = $urlBuilder->useParameter('action');
     if (!empty($action) and $action != $this->defaultAction) {
         $parts[] = $action;
     }
     $controllerItem = $urlBuilder->useParameter('controllerItem');
     if (!empty($parts) or !empty($controllerItem) and $action != $this->defaultControllerItem) {
         $parts[] = $controllerItem;
     }
     $controllerGroup = $urlBuilder->useParameter('controllerGroup');
     if (!empty($parts) or !empty($controllerGroup) and $action != $this->defaultControllerGroup) {
         $parts[] = $controllerGroup;
     }
     $url->setPath('/' . implode('/', array_reverse($parts)));
     parent::build($url, $urlBuilder);
 }
예제 #4
0
 /**
  * @param Template $template
  * @param UrlBuilder $urlBuilder
  * @return string
  */
 protected function templateBuild(Template $template, UrlBuilder $urlBuilder)
 {
     $path = $template->build($urlBuilder->getAllParameters(), $usedParameters);
     foreach ($usedParameters as $name) {
         $urlBuilder->useParameter($name);
     }
     return $path;
 }