Skip to content

Instantly share code, notes, and snippets.

@adamjenkin
Created August 9, 2012 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamjenkin/3303287 to your computer and use it in GitHub Desktop.
Save adamjenkin/3303287 to your computer and use it in GitHub Desktop.
PTB - Enable support for container pages
protected internal virtual IPageType CreateNewPageType(PageTypeDefinition definition)
{
IPageType pageType = PageTypeRepository.CreateNew();
PageTypeAttribute attribute = definition.Attribute;
string name = attribute.Name;
if (name == null)
{
name = definition.Type.Name;
}
pageType.Name = name;
if (definition.Attribute.Guid.HasValue)
pageType.GUID = definition.Attribute.Guid.Value;
string filename = attribute.Filename;
// check for null rather than IsNullOrEmpty, that way a developer can set filename="" and use the pagetype as a container page.
// OLD CODE -- if (string.IsNullOrEmpty(filename))
if (filename == null)
{
filename = DefaultFilename;
}
pageType.FileName = filename;
PageTypeRepository.Save(pageType);
NewlyCreatedPageTypes.Add(pageType);
return pageType;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment