A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
Via code?
In the EPiServer GUI you could move the page /w drag-n-drop to another parent or use cut-n-paste.
Found a solution. Call DataFactory.Instance.Move when page is beeing published.
Hi Anders,
Your server code is a best way, I just want to introduce an alternative way using client side ;)
var contentDataStore = registry.get("epi.cms.contentdata"),
contentStructureStore = registry.get("epi.cms.content.light");
//--------------------------------------------------------------------------------------
// Listen change content status actions
//--------------------------------------------------------------------------------------
aspect.around(contentDataStore, "executeMethod", function (originalMethod) {
return function (method, id, data, options) {
return when(originalMethod.apply(contentDataStore, arguments), function (result) {
if (result && result.success && epi.areEqual(method, "ChangeStatus")) {
var saveAction = ContentActionSupport.saveAction,
action = ContentActionSupport.action,
currentAction = data && data.action;
switch (currentAction) {
case action.Reject:
// TODO: Do whatever you want
break;
case action.Publish:
// Move the published page to new destination
when(contentStructureStore.move(id, {targetId: publishedPageContainer /*Replace with your real content reference*/ }), function(moveContentResult) {
topic.publish("/epi/cms/contentdata/childrenchanged", publishedPageContainer);
});
break;
case action.CheckIn:
// TODO: Do whatever you want
break;
case saveAction.CheckIn | saveAction.DelayedPublish | saveAction.ForceCurrentVersion:
// TODO: Do whatever you want
break;
default:
break;
}
}
return result;
})
}
})
Happy coding!
Ha Bui
Hi,
Is it possible in any way to change the ParentLink of a page while the page is published?
The ParentLink property (args.Page.ParentLink) seems to be read only.