public virtual bool Transform(ITransferContentData transferContentData) { var pageType = transferContentData.RawContentData.PageType(); // Don't import certain system page types if (SystemPageTypes.Contains(pageType)) { return(false); } // Don't import Personalization Containers if (transferContentData.RawContentData.GetProperty(ComposerProperties.PersonalizationData) != null) { return(false); } // Don't import empty ComposerContainers if (transferContentData.IsComposerContainer()) { var parent = _contentMap.GetParentPage(transferContentData.RawContentData.PageGuid()); if (parent == null) { return(false); } } return(true); }
public virtual bool Transform(ITransferContentData transferContentData) { var rawContent = transferContentData.RawContentData; var functionProperty = rawContent.GetProperty(ComposerProperties.ContentFunction); if (functionProperty == null) { return(true); } // Deserialize the Extension Function Struct var functionInfo = _composerSerializer.Deserialize <ComposerContentFunctionInformation>(functionProperty.Value); var isGlobalBlock = functionInfo != null && functionInfo.Type == ComposerContentFunctionCategory.Global; var guid = transferContentData.RawContentData.PageGuid(); var parent = _contentMap.GetParentPage(guid); // If a (non-global) block doesn't have a parent, it's an orphaned block and we won't import it if (parent == null && !_includeUnusedBlocks && !isGlobalBlock) { return(false); } // Move all Global and Unused blocks to the GlobalBlockFolder if (isGlobalBlock || parent == null) { rawContent.SetPropertyValue(MetaDataProperties.PageParentLink, _exportLinkResolver.GetExportableLink(ContentReference.GlobalBlockFolder)); } // Update the PageName to a more friendly name var property = rawContent.GetProperty(MetaDataProperties.PageName); if (property != null) { var friendlyName = CreateFriendlyName(rawContent, functionInfo); if (!string.IsNullOrEmpty(friendlyName)) { property.Value = friendlyName; } } // Don't change language of Global Blocks if (!isGlobalBlock && parent != null) { rawContent.Language(parent.Language); rawContent.MasterLanguage(parent.Language); } return(true); }
public virtual bool Transform(ITransferContentData transferContentData) { if (!transferContentData.IsComposerContainer()) { return(true); } var parent = _contentMap.GetParentPage(transferContentData.RawContentData.PageGuid()); if (parent == null && !_includeUnusedBlocks) { return(false); } transferContentData.ForAllContent(c => TransformContainer(c, parent)); return(true); }