public function getDetailUrl($contextNavItemId = null) { if ($contextNavItemId) { return \cms\helpers\Url::toMenuItem($contextNavItemId, 'news/default/detail', ['id' => $this->id, 'title' => \yii\helpers\Inflector::slug($this->title)]); } return \luya\helpers\Url::toManager('news/default/detail', ['id' => $this->id, 'title' => \yii\helpers\Inflector::slug($this->title)]); }
public function getDetailUrl($contextNavItemId = null) { if ($contextNavItemId) { return \cms\helpers\Url::toMenuItem($contextNavItemId, 'gallery/album/index', ['albumId' => $this->id, 'title' => \yii\helpers\Inflector::slug($this->title)]); } return \luya\helpers\Url::toManager('gallery/album/index', ['albumId' => $this->id, 'title' => \yii\helpers\Inflector::slug($this->title)]); }
public function testToModule() { Yii::$app->request->baseUrl = ''; Yii::$app->request->scriptUrl = ''; $url = \cms\helpers\Url::toMenuItem(1, 'news/default/detail', ['id' => 1, 'title' => 'foo-bar']); $this->assertEquals('/1/foo-bar', $url); }
public function eventBeforeRender($event) { if ($this->value == 1) { if (Yii::$app->getModule('account')->getUserIdentity()->isGuest) { $event->isValid = false; return Yii::$app->response->redirect(Url::toModuleRoute('account', 'account/default/index', ['ref' => Yii::$app->request->url])); } } }
public function testToModuleRoute() { Yii::$app->request->baseUrl = ''; Yii::$app->request->scriptUrl = ''; $this->assertEquals('/en/news-module/1/foo-bar', Url::toModuleRoute('news', 'news/default/detail', ['id' => 1, 'title' => 'foo-bar'])); }
<body> <?php $this->beginBody(); ?> <div id="header"> <div class="container"> <div class="row"> <div class="col-md-4"> <h1>Luya Website <small>on <?php echo YiiUrl::base(true); ?> </small></h1> </div> <div class="col-md-4"> <form method="get" action="<?php echo CmsUrl::toModule('crawler'); ?> "> <input type="text" name="query" /> <input type="submit" value="Go" /> </form> </div> <div class="col-md-4"> <div class="git pull-right"> <a href="https://github.com/zephir/luya" target="_blank" alt="Luya on GitHub" title="Luya on GitHub"><i class="fa fa-github fa-4x"></i></a> </div> </div> </div> </div> </div> <div id="nav">