I have a p2 macro that stores data in AO. When the page is copied, I want to copy the macro’s data to new AO records for macros on the new page. To do this, I need to know what the source page of a copy was when rendering a macro on the copied page.
At first I tried listening to the page copy events but after testing these seem to only be fired when the page tree is copied, but not when an individual page is copied. Next I tried setting
ContentEntityObject properties, both via
CEO.setProperty and using the
ContentPropertyManager. Values set with these methods do not persist after a page is copied.
I also tried finding a way to create an invisible (to the user) macro param or macro body that would allow me to propagate macro state across page copies using the storage format data. So far, I have not found a way to encode data in storage format that is invisible to a user.
The data would ideally be readable and writable during the
execute method of the server-side macro class. This is normally a bodiless macro, so I would prefer to not have an editable body in the page editor.
Is there a way to set a content property that will persist through a page copy operation, to encode an invisible macro param, or encode invisible data into a macro body, any of which would be present in a copied page environment?