when create content, create it for 2 document types at once
hi
I have 2 document types: first one is named BasePage and second one PageComponents. Now in Permitions BasePage is Allowed as root and has Allowed Child node types PageComponents.
How do I make it so when in Content I'm creating BasePage, I create BasePage and PageComponents under it all at one
I think you can create BasePage and PageComponent in content. And just PageComponent Under BasePage...
Unless you don't have the right, you can create all your document type under content and only the ones you decide by setting them up as a child, under the other document types.
Meaning my "Accueil" is your BasePage and my "Page" is your PageComponent ?!? When I create My Accueil, I have the Page component avalaible to be created under it. If I create a new Accueil, I could also create page underneath.
Natalie, All this is already present. However when I create Accuil (my BasePage) automatically one Page (my PageComponent) should be created, that is requirement. 2 creations with 1 step
I've solved it. needs to override ContentService_Saved where we check if the content service is from the required content type to add another content service as child. This means in Umbraco 8 need to do the following:
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class MyComposer : IUserComposer
{
public void Compose(Composition composition)
{
//composition.SetContentLastChanceFinder<My404ContentFinder>();
composition.Components().Append<MyComponent>();
}
}
class MyComponent : IComponent
{
public void Initialize()
{
ContentService.Saved += this.ContentService_Saved;
}
public void Terminate()
{
}
private void ContentService_Saved(IContentService sender, SaveEventArgs<IContent> e)
{
long totalChildren;
var contentService = sender;
var ents = e.SavedEntities.Where(x => x.ContentType.Alias == "myPage");
foreach (var node in ents)
{
if (!contentService.GetPagedChildren(node.Id, 0, 10, out totalChildren).Any(x => x.ContentType.Alias == "ComponentFolder"))
{
var pageComponentsFolder = contentService.CreateContent("Components", node.GetUdi(), "ComponentFolder");
contentService.SaveAndPublish(pageComponentsFolder);
}
}
}
when create content, create it for 2 document types at once
hi
I have 2 document types: first one is named BasePage and second one PageComponents. Now in Permitions BasePage is Allowed as root and has Allowed Child node types PageComponents.
How do I make it so when in Content I'm creating BasePage, I create BasePage and PageComponents under it all at one
please advice
Hullo,
I think you can create BasePage and PageComponent in content. And just PageComponent Under BasePage... Unless you don't have the right, you can create all your document type under content and only the ones you decide by setting them up as a child, under the other document types.
I hope it help...
Hi, Natalie,
that's not the point. The requirement is that whenever I create BasePage, the PageComponents should be created automatically under it.
please advice
Thing like that :
Meaning my "Accueil" is your BasePage and my "Page" is your PageComponent ?!? When I create My Accueil, I have the Page component avalaible to be created under it. If I create a new Accueil, I could also create page underneath.
Natalie, All this is already present. However when I create Accuil (my BasePage) automatically one Page (my PageComponent) should be created, that is requirement. 2 creations with 1 step
Guys, does anybody else have a suggestion? It is possible because I've seen it on USkinned
I've solved it. needs to override ContentService_Saved where we check if the content service is from the required content type to add another content service as child. This means in Umbraco 8 need to do the following:
is working on a reply...