Class ContentLanguageSettingsHandler
Tracks all language settings on a site with support for resolving closest setting at runtime
Implements
Inherited Members
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 7.19.2Syntax
public class ContentLanguageSettingsHandler : IContentLanguageSettingsHandler
Constructors
ContentLanguageSettingsHandler(IContentRepository, IContentEvents, ILanguageBranchRepository, IContentProviderManager)
Declaration
public ContentLanguageSettingsHandler(IContentRepository contentRepository, IContentEvents contentEvents, ILanguageBranchRepository languageBranchRepository, IContentProviderManager contentProviderManager)
Parameters
Type | Name | Description |
---|---|---|
IContentRepository | contentRepository | |
IContentEvents | contentEvents | |
ILanguageBranchRepository | languageBranchRepository | |
IContentProviderManager | contentProviderManager |
Properties
Instance
The global instance of ContentLanguageSettingsHandler that is used to access information about language settings
Declaration
public static ContentLanguageSettingsHandler Instance { get; }
Property Value
Type | Description |
---|---|
ContentLanguageSettingsHandler |
Methods
Clear()
Clears all currently loaded settings for this instance.
Declaration
public static void Clear()
Remarks
This can be used to force a reload of the settings tree.
ClearCache()
Clears all currently loaded settings for this instance.
Declaration
public void ClearCache()
Remarks
This can be used to force a reload of the settings tree.
CreateInstance(IContentRepository, IContentEvents, ILanguageBranchRepository, IContentProviderManager)
Creates a new not initialized instance.
Declaration
[Obsolete("Use service locator to get an instance of this class")]
public static ContentLanguageSettingsHandler CreateInstance(IContentRepository contentRepository, IContentEvents contentEvents, ILanguageBranchRepository languageBranchRepository, IContentProviderManager contentProviderManager)
Parameters
Type | Name | Description |
---|---|---|
IContentRepository | contentRepository | The datafactory to use |
IContentEvents | contentEvents | The content events. |
ILanguageBranchRepository | languageBranchRepository | The language branch repository. |
IContentProviderManager | contentProviderManager | The content provider manager. |
Returns
Type | Description |
---|---|
ContentLanguageSettingsHandler |
Get(ContentReference)
Gets the settings for all languages for the specified content link.
Declaration
public virtual ContentLanguageSetting[] Get(ContentReference contentLink)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content link. |
Returns
Type | Description |
---|---|
ContentLanguageSetting[] | An ContentLanguageSetting[] with the language settings for the given content. |
Get(ContentReference, String)
Gets the settings for specified content link and language.
Declaration
public virtual ContentLanguageSetting Get(ContentReference contentLink, string languageBranch)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content link. |
System.String | languageBranch | The language branch. |
Returns
Type | Description |
---|---|
ContentLanguageSetting | Gets the affective language settings for the content and language or null if no settings exists. |
Get(PageReference)
Gets the settings for all languages for the specified page link.
Declaration
[Obsolete("Use ContentLanguageSetting[] Get(ContentReference contentLink) instead")]
public virtual PageLanguageSetting[] Get(PageReference contentLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | contentLink | The page link. |
Returns
Type | Description |
---|---|
PageLanguageSetting[] | An PageLanguageSetting[] with the language settings for the given page. |
Get(PageReference, String)
Gets the settings for specified content link and language.
Declaration
[Obsolete("Use ContentLanguageSetting Get(ContentReference contentLink, string languageBranch) instead")]
public virtual PageLanguageSetting Get(PageReference contentLink, string languageBranch)
Parameters
Type | Name | Description |
---|---|---|
PageReference | contentLink | The page link. |
System.String | languageBranch | The language branch. |
Returns
Type | Description |
---|---|
PageLanguageSetting | Gets the affective language settings for the page and language or null if no settings exists. |
GetClosestSetting(ContentReference)
Gets the closest ancestor that has language settings.
Declaration
public virtual ContentReference GetClosestSetting(ContentReference contentLink)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content link. |
Returns
Type | Description |
---|---|
ContentReference | The closest ancestor that has language settings. |
GetClosestSetting(PageReference)
Gets the closest ancestor that has language settings.
Declaration
[Obsolete("Use overload that works with ContentReference instead")]
public virtual PageReference GetClosestSetting(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink | The page link. |
Returns
Type | Description |
---|---|
PageReference | The closest ancestor that has language settings. |
GetDefaultAllowedLanguage(ContentReference)
Try finding the default language if allowed, otherwise fallback to the first allowed language found
Declaration
public virtual string GetDefaultAllowedLanguage(ContentReference contentLink)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content to fetch language for |
Returns
Type | Description |
---|---|
System.String |
GetFallbackLanguages(ContentReference, String)
Gets the fallback languages for the current content and language if any exists.
Declaration
public virtual string[] GetFallbackLanguages(ContentReference contentLink, string languageBranch)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content link. |
System.String | languageBranch | The language branch. |
Returns
Type | Description |
---|---|
System.String[] | A String[] with the names of the fallback languages. |
Remarks
If no fallback languages are defined for the current content and language an empty string array is returned.
IsLanguageAllowed(ContentReference, String)
Checks if a language is available for a content
Declaration
public virtual bool IsLanguageAllowed(ContentReference contentLink, string languageBranch)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content to check |
System.String | languageBranch | The language to check |
Returns
Type | Description |
---|---|
System.Boolean | True if the language is allowed on the content |
IsLanguageAllowedForCreation(ContentReference, String)
Determins if a content is allowed in a specific language
Declaration
public virtual bool IsLanguageAllowedForCreation(ContentReference contentLink, string languageBranch)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content to check |
System.String | languageBranch | The language to check if it's allowed for the content |
Returns
Type | Description |
---|---|
System.Boolean | True if the language is allowed for the content |
Remarks
If no restrictions set on contents, the language must at least be part of the enabled languages for the site
IsSettingsDefined(ContentReference)
Determines whether there exists language settings for the given content.
Declaration
public virtual bool IsSettingsDefined(ContentReference contentLink)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | The content link. |
Returns
Type | Description |
---|---|
System.Boolean |
|