protected override IContent LoadContent(ContentReference contentLink, ILanguageSelector languageSelector) { if (ContentReference.IsNullOrEmpty(contentLink) || contentLink.ID == 0) { throw new ArgumentNullException("contentLink"); } if (contentLink.WorkID > 0) { return(_contentStore.LoadVersion(contentLink, -1)); } var languageBranchRepository = DependencyHelper.LanguageBranchRepository; LanguageBranch langBr = null; if (languageSelector.Language != null) { langBr = languageBranchRepository.Load(languageSelector.Language); } if (contentLink.GetPublishedOrLatest) { return(_contentStore.LoadVersion(contentLink, langBr != null ? langBr.ID : -1)); } // Get published version of Content var originalContent = _contentStore.Load(contentLink, langBr != null ? langBr.ID : -1); var page = originalContent as PageData; if (page == null) { throw new NotSupportedException("Only cloning of pages is supported"); } return(ClonePage(page)); }
protected override IContent LoadContent(ContentReference contentLink, ILanguageSelector languageSelector) { if (ContentReference.IsNullOrEmpty(contentLink) || contentLink.ID == 0) { throw new ArgumentNullException("contentLink"); } if (contentLink.WorkID > 0) { return(ContentStore.LoadVersion(contentLink, -1)); } var languageBranchRepository = ServiceLocator.Current.GetInstance <ILanguageBranchRepository>(); return(Load(contentLink, languageSelector)); /* var context = new LanguageSelectorContext(contentLink, languageBranchRepository, Load); * var culture = languageSelector.Language; * * if (contentLink.GetPublishedOrLatest) * { * languageSelector.SelectPageLanguage(context); * * LanguageBranch langBr = null; * * if (context.SelectedLanguage != null) * { * langBr = languageBranchRepository.Load(context.SelectedLanguage); * } * * return ContentStore.LoadVersion(contentLink, langBr != null ? langBr.ID : -1); * } * * languageSelector .SetInitializedLanguageBranch(context); * * // Get published version of Content * var originalContent = ContentStore.Load(contentLink, context.SelectedLanguageBranch != null ? context.SelectedLanguageBranch.ID : -1); * * var page = originalContent as PageData; * * if(page == null) * { * throw new NotSupportedException("Only cloning of pages is supported"); * } * * return ClonePage(page);*/ }