0

I have a scenario where I have to enable the fallback for a template and on some particular scenarios I have to show the language versions only if it has that particular version. Ex: If it has a non english version show that version only in that language(no fall back) Item.Versions.count>0 returns true if I set Enable fall back to true. Is there a way I check if the version that is returned is fall back version speifically

3 Answers 3

5

You can call Item.IsFallback, which returns true if the item in question is fallback item.

Source:

https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/language_fallback/setting_up/language_fallback__changes_to_apis

2

You can use property IsFallBack. As per sitecore's documentation

The Sitecore.Data.Item class

The following properties have been added to the class:

OriginalLanguage – a property that returns the original language for the current item. If the item is not a fallback item, it returns the item.Language.

IsFallback – a property that returns true if the current item is a fallback item.

0

The Item class (in Sitecore.Kernel.dll, SC 8.1+) has a IsFallback property that will indicate if the item is a fallback item.

/// <summary>
/// Gets a value that indicates if the item is a fallback item.
/// </summary>
/// <value>
/// <c>true</c> if this item is a fallback item; otherwise, <c>false</c>.
/// </value>
public bool IsFallback
{
    get
    {
    return this._originalLanguage != (Language) null;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.