November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi,
I don't know to which event you are attached, but I think that if you use ContentSaving event, than you don't need to create clone or save content - just reset all properties:
[InitializableModule] public class CustomModule : IInitializableModule { public void Initialize(InitializationEngine context) { var contentEvents = context.Locate.ContentEvents(); contentEvents.SavingContent += ContentEvents_SavingContent; } private void ContentEvents_SavingContent(object sender, ContentEventArgs e) { var pollBlock = e.Content as PollBlock; if (pollBlock == null || pollBlock.ResetVotes == false) { return; } pollBlock.CountAnswer1 = 0; pollBlock.CountAnswer2 = 0; pollBlock.CountAnswer3 = 0; pollBlock.CountAnswer4 = 0; pollBlock.CountAnswer5 = 0; pollBlock.CountAnswerTotal = 0; pollBlock.VotedBy = string.Empty; pollBlock.ResetVotes = false; } public void Uninitialize(InitializationEngine context) { } }
Hi I have another specific feature i have to make:
I want to have a 'checkbox' in a block, that can be used to reset other properties of the same blocktype. I use a page events InitializableModule that checks if a certain blocktype is updated:
It all seems to work, however, because i change the block whilst it was active, it keeps asking me to publish the page. How can i properly update the Block and go back to previewing the block?
Thanks in advance