In order to create a new Component, I will go to the Folder level and select "Create New Component" from ribbon toolbar.
Before the Component completely loads, I want to set some default content for this Component.
I am trying through the following event handler:
EventSystem.Subscribe<Component, LoadEventArgs>(LoadComponentData,
EventPhases.TransactionCommitted);
And then:
private void LoadComponentData(Component component, LoadEventArgs args, EventPhases phases)
{
Logger.WriteWarning("Component Title" + component.Title, ErrorCode.GENERAL);
Logger.WriteWarning("Component Title" + component.Content, ErrorCode.GENERAL);
}
I am getting an empty value for component.Content
, is there any other way to set/get the Component content for newly created Components?
What I require is, before this newly created Component completely loads to the author, I would like to set some default value for this Component. (Note: I am explicitly saying for the newly created Component, not when opening an existing one).
I can't use the Default Data from the Schema since I want to set multiple values in a multiple value field, and via the Schema I can only set a single value.