November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
I haven't never tried it, but I think you can set the name inside your SetDefaultValue method (of your content type). If the name is not empty then the box will not probably not show
Hi,
Have you tried this-
PageData myPage = contentRepository.GetDefault<PageData>(parent, contentTypeRepository.Load("Standard page").ID);
myPage.PageName = "My new page";
contentRepository.Save(myPage, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
For disabling the properties you can hide them based on the roles.
And you can catch the create event pipeline-
[ModuleDependency(typeof(InitializationModule))]
public class MyCustomInitModule : IInitializableModule
{
private IContentEvents _contentEvents;
public void Initialize(InitializationEngine context)
{
if (_contentEvents == null)
{
_contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>();
}
_contentEvents.CreatingContent+= ContentEvents_CreatingContent;
}
private void ContentEvents_CreatingContent(object sender, ContentEventArgs e)
{
var articlePage = e.Content as ArticlePage;
if (articlePage != null)
{
// TODO: ...
}
}
public void Uninitialize(InitializationEngine context)
{
if (_contentEvents == null)
{
_contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>();
}
_contentEvents.CreatingContent -= ContentEvents_CreatingContent;
}
}
FYI - You can use page name code in this initialization as well.
Hi guys,
Thanks for your help. Eventually I used the event pipepeline:
private void ContentEvents_CreatingContent(object sender, ContentEventArgs e)
{
if (e.Content is DataPortalUpdatePage dataPortalUpdatePage)
{
dataPortalUpdatePage.Name = "Update " +
DateTime.Now.Date.ToShortDateString();
}
}
Is does show the Name input box, and the user input is replaced by the value in the code above, which is perhaps less than desirable. But the user can change it later.
Is it possible to set the page name programmatically in Episerver 11, and hide the page name input box on page creation?
And if possible, how can this be done? Is there an event hook which can be used?