/** * Adds cache breaker to router. * Sets profiles routes */ public function onAppRequest() { App::router()->setOption('userprofile.profilelink', '{slug}'); $this->nodes = Node::query()->where("link LIKE '@userprofile/profiles/%'")->get(); foreach ($this->nodes as $node) { App::routes()->add(['name' => '@userprofile/profiles/' . $node->slug, 'controller' => 'Bixie\\Userprofile\\Controller\\ProfilesController::indexAction', 'label' => $node->title, 'defaults' => ['_node' => $node->id, 'roles' => $node->get('show_roles')], 'path' => $node->path]); App::routes()->add(['name' => '@userprofile/profiles/' . $node->slug . '/page', 'controller' => 'Bixie\\Userprofile\\Controller\\ProfilesController::indexAction', 'label' => $node->title, 'defaults' => ['_node' => $node->id, 'roles' => $node->get('show_roles')], 'path' => $node->path . '/page/{page}']); App::routes()->add(['name' => '@userprofile/profiles/' . $node->slug . '/id', 'controller' => 'Bixie\\Userprofile\\Controller\\ProfilesController::detailsAction', 'label' => __('Details'), 'defaults' => ['_node' => $node->id], 'path' => $node->path . '/{slug}']); } }
/** * Adds cache breaker to router. */ public function onAppRequest() { App::router()->setOption('blog.permalink', UrlResolver::getPermalink()); }