Zeka Posted October 27, 2018 Share Posted October 27, 2018 Hi. I have hooks to Page::path like wire()->addHookAfter("Page(template=blog-entry|blog-category)::path", function($e) { $page = $e->object; $pages = wire('pages'); $user = wire('user'); $language = $user->language; $langSegment = $pages->get("/")->localPath($language); $pageName = $page->localName($language, true); $e->return = $langSegment . "$pageName/"; }); This hook changes pages path in frontend and 'view' action in PageTree, but it doen't in 'view' tab on page edit screen and page url in config tab of page edit screen Is there a way (hook) how to change page path in these places? (at least view links). Thanks, Eugene. Link to comment Share on other sites More sharing options...
Zeka Posted November 24, 2018 Author Share Posted November 24, 2018 Any thoughts? Link to comment Share on other sites More sharing options...
Orkun Posted June 23, 2021 Share Posted June 23, 2021 Hi @Zeka Have you found a solution for this? We also have a hook to Page::path. After the upgrade to PW3 the view links inside the processpageedit page doesn't work anymore or better said the hook doesn't have an effect there. KR Orkun Link to comment Share on other sites More sharing options...
Zeka Posted June 23, 2021 Author Share Posted June 23, 2021 Hi @Orkun // For view actions urls and all url for the pages wire()->addHookAfter("Page(template=post)::path, Page(template=post)::localHttpUrl, Page(template=post)::localUrl, Page(template=post)::localPath", function($e) { $page = $e->object; $pages = wire('pages'); $user = wire('user'); $language = $user->language; $langSegment = $pages->get("/")->localPath($language); $pageName = $page->localName($language, true); $e->return = $langSegment . "$pageName/"; }); // this hook is needed to change parent path so we can get right url in link above page name field wire()->addHookBefore("InputfieldPageName::render", function($e) { $inputfield = $e->object; $parentPageID = $inputfield->parentPage->id; $hookId = wire()->addHookAfter("Page(id=$parentPageID)::path", function($e) { $pages = wire('pages'); $user = wire('user'); $language = $user->language; $langSegment = $pages->get("/")->localPath($language); $e->return = $langSegment; }); wire()->addHookAfter("InputfieldPageName::render", function($e) use($hookId){ $e->removeHook($hookId); }); }); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now