/** * Sets the "url" attribute with a URL to this object * @param string $pageName * @param Cms\Classes\Controller $controller */ public function setUrl($controller, $page) { $params_view = ['asset_id' => $this->id, 'action' => 'view']; $params_update = ['asset_id' => $this->id, 'action' => 'update']; $this->url_view = $controller->pageUrl($page, $params_view); $this->url_update = $controller->pageUrl($page, $params_update); }
/** * Sets the "url" attribute with a URL to this object * @param string $pageName * @param Cms\Classes\Controller $controller */ public function setUrl($pageName, $controller) { $params = ['id' => $this->id, 'slug' => $this->slug]; if (array_key_exists('categories', $this->getRelations())) { $params['category'] = $this->categories->count() ? $this->categories->first()->slug : null; } return $this->url = $controller->pageUrl($pageName, $params); }
/** * Sets the "url" attribute with a URL to this object * @param string $pageName * @param Cms\Classes\Controller $controller */ public function setUrl($pageName, $controller) { $params = ['id' => $this->id, 'slug' => $this->slug]; if (array_key_exists('categories', $this->getRelations())) { $params['category'] = $this->categories->count() ? $this->categories->first()->slug : null; } //expose published year, month and day as URL parameters if ($this->published) { $params['year'] = $this->published_at->format('Y'); $params['month'] = $this->published_at->format('m'); $params['day'] = $this->published_at->format('d'); } return $this->url = $controller->pageUrl($pageName, $params); }
/** * Sets the "url" attribute with a URL to this object * @param string $pageName * @param Cms\Classes\Controller $controller */ public function setUrl($pageName, $controller) { $params = ['id' => $this->id, 'slug' => $this->slug]; return $this->url = $controller->pageUrl($pageName, $params); }
/** * Sets the "url" attribute with a URL to this object * @param string $pageName * @param Cms\Classes\Controller $controller */ public function setUrl($pageName, $controller) { $params = ['calendarSlug' => $this->slug]; $this->url = $controller->pageUrl($pageName, $params); return $this->url; }