I have subscribed to the following event:
private void Subscribe()
{
EventSystem.Subscribe<Component, PublishEventArgs>(ComponentPrePublish, EventPhases.TransactionCommitted);
}
private void ComponentPrePublish(Component component, PublishEventArgs e, EventPhases phase)
{
if (e.PublishInstruction.ResolveInstruction.Purpose == ResolvePurpose.Publish)
{
MethodForComponentUpdate(component);
}
}
Everything is working fine when I publish a component.
But, when I publish a component and check "Also Publish in Child Publications" my expectation is that this event will trigger for parent + each child component being published. It is not, it is only triggering for parent component.
Am I doing something wrong or is this behavior by design?
Edit - adding requirements:
Requirement that I am trying to solve is whenever component is publish, metadata fields of that component need to be updated before rendering is started.
Edit 2 - more clarifications:
I need to add/update component metadata with appropriate taxonomy before component is published (not saved, as it is too dynamic) so that content can be correctly queried on CD side. This should also match CM taxonomy so that Content Editors know what they are doing.