Class ConsentInfoExtensions
- Namespace
- CMS.DataProtection
- Assembly
- CMS.DataProtection.dll
Extension methods for ConsentInfo.
public static class ConsentInfoExtensions
- Inheritance
-
objectConsentInfoExtensions
Methods
GetConsentLanguages(ConsentInfo)
Gets language names from the consents language variants.
public static IEnumerable<string> GetConsentLanguages(this ConsentInfo consent)
Parameters
consentConsentInfoConsent info.
Returns
- IEnumerable<string>
GetConsentTextAsync(ConsentInfo, string)
Gets consent's text for specific languageName. The method follows the language fallback chain when retrieving
consent text language variant.
public static Task<ConsentText> GetConsentTextAsync(this ConsentInfo consent, string languageName)
Parameters
consentConsentInfoConsent for which the text gets retrieved.
languageNamestringLanguage of the consent text.
Returns
- Task<ConsentText>
Language specific consent's text.
Exceptions
- ArgumentNullException
Thrown when
consentis null.- ArgumentException
Thrown when
languageNameis null, empty or does not correspond to an existing content language.
GetConsentTextWithoutFallback(ConsentInfo, string)
Gets consent's text for the exact languageName without following the language fallback chain.
public static ConsentText GetConsentTextWithoutFallback(this ConsentInfo consent, string languageName)
Parameters
consentConsentInfoConsent for which the text gets retrieved.
languageNamestringLanguage of the consent text.
Returns
- ConsentText
Language specific consent's text.
Exceptions
- ArgumentNullException
Thrown when
consentis null.- ArgumentException
Thrown when
languageNameis null or empty.
HasLanguageVariant(ConsentInfo, string)
Indicates whether a given consent's text has a language variant specified by languageName.
public static bool HasLanguageVariant(this ConsentInfo consent, string languageName)
Parameters
consentConsentInfoConsent.
languageNamestringLanguage name.
Returns
- bool
UpsertConsentText(ConsentInfo, string, string, string)
Adds new or updates existing consent language variant.
public static void UpsertConsentText(this ConsentInfo consent, string languageName, string shortText, string fullText)
Parameters
consentConsentInfoConsent info.
languageNamestringLanguage of the consent text.
shortTextstringShort text of consent.
fullTextstringFull text of consent.
Exceptions
- ArgumentNullException
Thrown when
consentis null.- ArgumentException
Thrown when
languageNameisnullor empty.- ArgumentNullException
Thrown when
shortTextisnull.- ArgumentNullException
Thrown when
fullTextisnull.