I have a user macro that moved a page to another parent:
The macro is triggered when the page is displayed not when the button is pushed. If I manually move a page to a different parent, it is moved right back without clicking the button.
Why is this happening? How can I get it to work as intended?
## @noparams
#set ($pageManager = $action.getPageManager())
#set ($page = $content.getEntity())
#set ($destinationPage = $pageManager.getPage(309990621))
<button class="aui-button" onclick="{$pageManager.movePageAsChild($page, $destinationPage)}">Activate Project</button>