public function getDetailUrl($contextNavItemId = null) { if ($contextNavItemId) { return \luya\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 \luya\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 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])); } } }
private function getLinkUrl() { $content = $this->getContextConfigValue($this->varName); return Url::generateLinkObject($content); }
public function testExternalGenerateLinkObject() { $url = Url::generateLinkObject(['type' => 2, 'value' => 'https://luya.io']); $this->assertInstanceOf('luya\\web\\LinkInterface', $url); $this->assertSame('_blank', $url->getTarget()); }
/** * Generate the link object from the given database array value. * * @param array $config The configuration array must contain the keys `value` and `type`. * @return string The parsed link source based on the input type. */ protected function generateLinkObject(array $config) { return Url::generateLinkObject($config); }