Get URL of a page that is in edit mode
Permalink
Hi all,
here is my issue. I would like to be able to get the original URL of the page that is currently edited.
An editor puts a page in edit mode and then he adds either a content block or a file block and uploads a file through the file manager. I would like to create an automatic notification function (triggered by on_file_add) that informs about the original URL (not the dynamic one in edit mode) of the page where the file will be added. When in edit mode, the page can be seen in the background, but I am not sure if c5 treats it as the "current page". I tried:
$myPage = Page::getCurrentPage();
$nh = Loader::helper('navigation');
$myURL = $nh->getCollectionURL($myPage);
but I get an empty string in $myURL.
To sum up, my questions would be:
1. Is there a way to get the original URL of a page that is currently in edit mode?
2. Is the URL also accessible when in edit mode the File Manager is launched?
Thanks a lot in advance!
here is my issue. I would like to be able to get the original URL of the page that is currently edited.
An editor puts a page in edit mode and then he adds either a content block or a file block and uploads a file through the file manager. I would like to create an automatic notification function (triggered by on_file_add) that informs about the original URL (not the dynamic one in edit mode) of the page where the file will be added. When in edit mode, the page can be seen in the background, but I am not sure if c5 treats it as the "current page". I tried:
$myPage = Page::getCurrentPage();
$nh = Loader::helper('navigation');
$myURL = $nh->getCollectionURL($myPage);
but I get an empty string in $myURL.
To sum up, my questions would be:
1. Is there a way to get the original URL of a page that is currently in edit mode?
2. Is the URL also accessible when in edit mode the File Manager is launched?
Thanks a lot in advance!