Created
August 9, 2012 11:05
-
-
Save adamjenkin/3303287 to your computer and use it in GitHub Desktop.
PTB - Enable support for container pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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