findCurrentMain() public static method

現在のサイトに関連するメインサイトを取得
public static findCurrentMain ( ) : BcSite | null
return BcSite | null
Exemplo n.º 1
0
 /**
  * After Render
  *
  * @param string $viewFile
  */
 public function afterRender($viewFile)
 {
     parent::afterRender($viewFile);
     $site = BcSite::findCurrent();
     if ($site->device != 'mobile' || $site->sameMainUrl) {
         return;
     }
     // 別URLの場合、canonicalを出力
     $pureUrl = $site->getPureUrl($this->request->url);
     $mainSite = BcSite::findCurrentMain();
     $url = $mainSite->makeUrl(new CakeRequest($pureUrl));
     $this->_View->set('meta', $this->BcHtml->meta('canonical', $this->BcHtml->url($url, true), ['rel' => 'canonical', 'type' => null, 'title' => null, 'inline' => false]));
 }