This structure is used because of the menu system used on our site. When I publish a node in Parent 1 I have some code which check to make sure it's the correct document type and then copies it to other nodes in the structure based on values set.
How do I automatically publish this new 'copied' node?
How do I automatically synchronize the content between all instances of this node?
How can I delete all instances of this node should it be deleted?
This is required for two reasons, the menu structure and to keep the process uniform as the content editor is not tech savvy at all. I could create a new template to make it easier for myself but this would mean the client has limited ability to change the menu structure as it would be hard coded and they can't edit the templates.
Any help, idea, sugguestions would be much appreciated.
1/ You publish the node as you'd normally would, but think you have issues getting the node that's being created in the copy process, right? It would be nice if the Copy method would return the just created node, wouldn't it? It doesn't, so you'll have to use other techniques. You could subscribe to the AfterCopy event on documents to find out what node has been copied and act upon (eg. publish the node). I agree it's not the most elegant solution, but it will work. Publishing a node is as simple as
2/ Subscribe to save/publish events for documents, check whether saved/published documents has related nodes (you've set 3rd parameter of Copy method to true, so each copied node is related to its 'parent' node) and update those nodes.
3/ Again, subscribe to delete events on documents, and find all related nodes and delete those as well.
Synchronize nodes
I have a structure as outlined below:
This structure is used because of the menu system used on our site. When I publish a node in Parent 1 I have some code which check to make sure it's the correct document type and then copies it to other nodes in the structure based on values set.
My questions are below:
This is required for two reasons, the menu structure and to keep the process uniform as the content editor is not tech savvy at all. I could create a new template to make it easier for myself but this would mean the client has limited ability to change the menu structure as it would be hard coded and they can't edit the templates.
Any help, idea, sugguestions would be much appreciated.
Hi NightWolf,
1/ You publish the node as you'd normally would, but think you have issues getting the node that's being created in the copy process, right? It would be nice if the Copy method would return the just created node, wouldn't it? It doesn't, so you'll have to use other techniques. You could subscribe to the AfterCopy event on documents to find out what node has been copied and act upon (eg. publish the node). I agree it's not the most elegant solution, but it will work. Publishing a node is as simple as
2/ Subscribe to save/publish events for documents, check whether saved/published documents has related nodes (you've set 3rd parameter of Copy method to true, so each copied node is related to its 'parent' node) and update those nodes.
3/ Again, subscribe to delete events on documents, and find all related nodes and delete those as well.
Hope this helps.
Regards,
/Dirk
Cheer, this was a good help all though not an elegant solution.
is working on a reply...