Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Commit

Permalink
[#449] [9.1] update to use new Item.DescendsFrom method
Browse files Browse the repository at this point in the history
  • Loading branch information
nickwesselman committed Nov 27, 2018
1 parent b812cf1 commit 17b8955
Show file tree
Hide file tree
Showing 57 changed files with 78 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public virtual IEnumerable<string> GetInterests()
{
var item = GetSettingsItem(null);

return item?.TargetItem(Templates.ProfileSettigs.Fields.InterestsFolder)?.Children.Where(i => i.IsDerived(Templates.Interest.ID))?.Select(i => i.Fields[Templates.Interest.Fields.Title].Value) ?? Enumerable.Empty<string>();
return item?.TargetItem(Templates.ProfileSettigs.Fields.InterestsFolder)?.Children.Where(i => i.DescendsFrom(Templates.Interest.ID))?.Select(i => i.Fields[Templates.Interest.Fields.Title].Value) ?? Enumerable.Empty<string>();
}

private static Item GetSettingsItem(Item contextItem)
Expand Down
2 changes: 1 addition & 1 deletion src/Feature/Demo/code/Controllers/DemoController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ActionResult ExperienceDataContent()
public ActionResult DemoContent()
{
var item = RenderingContext.Current?.Rendering?.Item ?? RenderingContext.Current?.ContextItem;
if (item == null || !item.IsDerived(Templates.DemoContent.ID))
if (item == null || !item.DescendsFrom(Templates.DemoContent.ID))
{
throw new InvalidDataSourceItemException($"Item should be not null and derived from {nameof(Templates.DemoContent)} {Templates.DemoContent.ID} template");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Feature/Demo/code/Models/DemoContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private string ReplaceTokens(string content)

private string[] GetReplacementTokens()
{
return this.Item.Children.Where(i => i.IsDerived(Templates.Token.ID)).SelectMany(i => new[] {$"${i.Name}", i[Templates.Token.Fields.TokenValue]}).ToArray();
return this.Item.Children.Where(i => i.DescendsFrom(Templates.Token.ID)).SelectMany(i => new[] {$"${i.Name}", i[Templates.Token.Fields.TokenValue]}).ToArray();
}
}
}
2 changes: 1 addition & 1 deletion src/Feature/Demo/code/Pipelines/FakeTrackerData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void GetFakeTrackerData(PipelineArgs args)

private static TrackerData CreateTrackerData()
{
if (Sitecore.Context.Item == null || !Sitecore.Context.Item.IsDerived(Templates.DemoContent.ID))
if (Sitecore.Context.Item == null || !Sitecore.Context.Item.DescendsFrom(Templates.DemoContent.ID))
return null;

var demoContent = new DemoContent(Sitecore.Context.Item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Models.Language GetActive()
var languages = this.GetAll();
var siteDefinition = this.SiteContext.GetSiteDefinition(Context.Item);

if (siteDefinition?.Item == null || !siteDefinition.Item.IsDerived(Feature.Language.Templates.LanguageSettings.ID))
if (siteDefinition?.Item == null || !siteDefinition.Item.DescendsFrom(Feature.Language.Templates.LanguageSettings.ID))
{
return languages;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Feature/Maps/code/Repositories/MapPointRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public IEnumerable<MapPoint> GetAll(Data.Items.Item contextItem)
{
throw new ArgumentNullException(nameof(contextItem));
}
if (Foundation.SitecoreExtensions.Extensions.ItemExtensions.IsDerived(contextItem, Templates.MapPoint.ID))
if (contextItem.DescendsFrom(Templates.MapPoint.ID))
{
return new List<MapPoint>
{
new MapPoint(contextItem)
};
}
if (!Foundation.SitecoreExtensions.Extensions.ItemExtensions.IsDerived(contextItem, Templates.MapPointsFolder.ID))
if (!contextItem.DescendsFrom(Templates.MapPointsFolder.ID))
{
throw new ArgumentException("Item must derive from MapPointsFolder or MapPoint", nameof(contextItem));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static IEnumerable<MediaSelectorElement> Get([NotNull] Item item)
var active = "active";
foreach (var child in items)
{
if (child.IsDerived(Templates.HasMediaVideo.ID) && child[Templates.HasMediaVideo.Fields.VideoLink].IsEmptyOrNull() && child[Templates.HasMedia.Fields.Thumbnail].IsEmptyOrNull())
if (child.DescendsFrom(Templates.HasMediaVideo.ID) && child[Templates.HasMediaVideo.Fields.VideoLink].IsEmptyOrNull() && child[Templates.HasMedia.Fields.Thumbnail].IsEmptyOrNull())
{
continue;
}
Expand All @@ -38,13 +38,13 @@ public static IEnumerable<MediaSelectorElement> Get([NotNull] Item item)

private static IEnumerable<Item> GetMediaFromChildren(Item item)
{
return item.Children.Where(i => i.IsDerived(Templates.HasMedia.ID));
return item.Children.Where(i => i.DescendsFrom(Templates.HasMedia.ID));
}

private static IEnumerable<Item> GetMediaFromMultiList(Item item)
{
var multiListValues = item.GetMultiListValueItems(Templates.HasMediaSelector.Fields.MediaSelector);
return multiListValues.Where(i => i.IsDerived(Templates.HasMedia.ID));
return multiListValues.Where(i => i.DescendsFrom(Templates.HasMedia.ID));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@using Sitecore.Resources.Media
@model Sitecore.Mvc.Presentation.RenderingModel
@if (!Model?.Item?.IsDerived(Templates.HasMediaSelector.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.HasMediaSelector.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasMediaSelector.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand All @@ -32,7 +32,7 @@
<div class="block-grid-item">
<div class="thumbnail mosaic mosaic-circle lightbox-item lightbox-image">
<div class="mosaic-overlay mosaic-overlay-no-pointer">
@if (element.Item.IsDerived(Templates.HasMediaVideo.ID))
@if (element.Item.DescendsFrom(Templates.HasMediaVideo.ID))
{
<span class="fa fa-play-circle icon-lg"></span>
}
Expand All @@ -42,7 +42,7 @@
}
</div>
<div class="mosaic-backdrop">
@if (element.Item.IsDerived(Templates.HasMediaVideo.ID))
@if (element.Item.DescendsFrom(Templates.HasMediaVideo.ID))
{
var linkFieldUrl = element.Item.LinkFieldUrl(Templates.HasMediaVideo.Fields.VideoLink);
if (!string.IsNullOrWhiteSpace(linkFieldUrl))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@using Sitecore.Resources.Media
@model Sitecore.Mvc.Presentation.RenderingModel
@if (!Model?.Item?.IsDerived(Templates.HasMediaImage.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.HasMediaImage.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasMediaImage.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@model Sitecore.Mvc.Presentation.RenderingModel

@if (!Model?.Item?.IsDerived(Templates.HasMediaVideo.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.HasMediaVideo.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasMediaVideo.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@using Sitecore.Foundation.Theming.Extensions
@using Sitecore.Resources.Media
@model Sitecore.Mvc.Presentation.RenderingModel
@if (!Model?.Item?.IsDerived(Templates.HasMediaSelector.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.HasMediaSelector.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasMediaSelector.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand All @@ -25,7 +25,7 @@
{
<li data-target="#@carouselId" data-slide-to="@i" class="@elements[i].Active"></li>
int height;
var field = elements[i].Item.IsDerived(Templates.HasMediaVideo.ID) ? Templates.HasMedia.Fields.Thumbnail : Templates.HasMediaImage.Fields.Image;
var field = elements[i].Item.DescendsFrom(Templates.HasMediaVideo.ID) ? Templates.HasMedia.Fields.Thumbnail : Templates.HasMediaImage.Fields.Image;
if (int.TryParse(((ImageField)elements[i].Item.Fields[field]).Height, out height) && height > (carouselHeight ?? 0))
{
carouselHeight = height;
Expand All @@ -39,7 +39,7 @@
<div class="item @element.Active">
@{
var style = "background-image: ";
var field = element.Item.IsDerived(Templates.HasMediaVideo.ID) ? Templates.HasMedia.Fields.Thumbnail : Templates.HasMediaImage.Fields.Image;
var field = element.Item.DescendsFrom(Templates.HasMediaVideo.ID) ? Templates.HasMedia.Fields.Thumbnail : Templates.HasMediaImage.Fields.Image;
style += element.Item.ImageUrl(field, new MediaUrlOptions()).ToCssUrlValue();
var fixedHeight = Model.Rendering.IsFixedHeight();
if (fixedHeight && carouselHeight.HasValue)
Expand All @@ -49,7 +49,7 @@
}

<div class="jumbotron bg-media" style="@style">
@if (element.Item.IsDerived(Templates.HasMediaVideo.ID))
@if (element.Item.DescendsFrom(Templates.HasMediaVideo.ID))
{
<video autoplay="" loop="" muted="" class="video-bg img-responsive">
<source src="@element.Item.MediaUrl(Templates.HasMediaVideo.Fields.VideoLink)" type="video/mp4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@using Sitecore.Resources.Media
@model Sitecore.Mvc.Presentation.RenderingModel
@if (!Model?.Item?.IsDerived(Templates.HasMediaSelector.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.HasMediaSelector.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasMediaSelector.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand All @@ -30,12 +30,12 @@
<div class="item @element.Active">
@{
var style = "background-image: ";
var field = element.Item.IsDerived(Templates.HasMediaVideo.ID) ? Templates.HasMedia.Fields.Thumbnail : Templates.HasMediaImage.Fields.Image;
var field = element.Item.DescendsFrom(Templates.HasMediaVideo.ID) ? Templates.HasMedia.Fields.Thumbnail : Templates.HasMediaImage.Fields.Image;
style += element.Item.ImageUrl(field, new MediaUrlOptions()).ToCssUrlValue();
}

<div class="jumbotron jumbotron-xl bg-media" style="@style">
@if (element.Item.IsDerived(Templates.HasMediaVideo.ID))
@if (element.Item.DescendsFrom(Templates.HasMediaVideo.ID))
{
<video autoplay="" loop="" muted="" class="video-bg">
<source src="@element.Item.MediaUrl(Templates.HasMediaVideo.Fields.VideoLink)" type="video/mp4">
Expand Down
2 changes: 1 addition & 1 deletion src/Feature/Media/code/Views/MediaFeature/Video.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@using Sitecore.Resources.Media
@model Sitecore.Mvc.Presentation.RenderingModel

@if (Model == null || (!Model.Item?.IsDerived(Templates.HasMediaVideo.ID) ?? true))
@if (Model == null || (!Model.Item?.DescendsFrom(Templates.HasMediaVideo.ID) ?? true))
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasMediaVideo.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class SetFromPage
{
public void Process(GetPageMetadataArgs args)
{
if (!args.Item.IsDerived(Templates.PageMetadata.ID))
if (!args.Item.DescendsFrom(Templates.PageMetadata.ID))
return;

this.SetKeywords(args.Item, args.Metadata.KeywordsList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private bool IsValidSiteConfiguration(SiteDefinition siteDefinition)

private bool IsSiteConfigurationItem(Item item)
{
return item.IsDerived(Multisite.Templates.SiteConfiguration.ID);
return item.DescendsFrom(Multisite.Templates.SiteConfiguration.ID);
}

private SiteConfigurations Create(IEnumerable<SiteDefinition> definitions)
Expand Down
10 changes: 5 additions & 5 deletions src/Feature/Navigation/code/Repositories/NavigationRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void AddRootToPrimaryMenu(NavigationItems navItems)

private bool IncludeInNavigation(Item item, bool forceShowInMenu = false)
{
return item.HasContextLanguage() && item.IsDerived(Templates.Navigable.ID) && (forceShowInMenu || MainUtil.GetBool(item[Templates.Navigable.Fields.ShowInNavigation], false));
return item.HasContextLanguage() && item.DescendsFrom(Templates.Navigable.ID) && (forceShowInMenu || MainUtil.GetBool(item[Templates.Navigable.Fields.ShowInNavigation], false));
}

public NavigationItem GetSecondaryMenuItem()
Expand Down Expand Up @@ -116,15 +116,15 @@ private IEnumerable<NavigationItem> GetNavigationHierarchy(bool forceShowInMenu

private NavigationItem CreateNavigationItem(Item item, int level, int maxLevel = -1)
{
var targetItem = item.IsDerived(Templates.Link.ID) ? item.TargetItem(Templates.Link.Fields.Link) : item;
var targetItem = item.DescendsFrom(Templates.Link.ID) ? item.TargetItem(Templates.Link.Fields.Link) : item;
return new NavigationItem
{
Item = item,
Url = item.IsDerived(Templates.Link.ID) ? item.LinkFieldUrl(Templates.Link.Fields.Link) : item.Url(),
Target = item.IsDerived(Templates.Link.ID) ? item.LinkFieldTarget(Templates.Link.Fields.Link) : "",
Url = item.DescendsFrom(Templates.Link.ID) ? item.LinkFieldUrl(Templates.Link.Fields.Link) : item.Url(),
Target = item.DescendsFrom(Templates.Link.ID) ? item.LinkFieldTarget(Templates.Link.Fields.Link) : "",
IsActive = this.IsItemActive(targetItem ?? item),
Children = this.GetChildNavigationItems(item, level + 1, maxLevel),
ShowChildren = !item.IsDerived(Templates.Navigable.ID) || item.Fields[Templates.Navigable.Fields.ShowChildren].IsChecked()
ShowChildren = !item.DescendsFrom(Templates.Navigable.ID) || item.Fields[Templates.Navigable.Fields.ShowChildren].IsChecked()
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/Feature/News/code/Repositories/NewsRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public IEnumerable<Item> Get(Item contextItem)
{
throw new ArgumentNullException(nameof(contextItem));
}
if (!contextItem.IsDerived(Templates.NewsFolder.ID))
if (!contextItem.DescendsFrom(Templates.NewsFolder.ID))
{
throw new ArgumentException("Item must derive from NewsFolder", nameof(contextItem));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Feature/News/code/Views/News/NewsArticle.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@using Sitecore.Foundation.Alerts.Extensions
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@model Sitecore.Mvc.Presentation.RenderingModel
@if (!Model?.Item?.IsDerived(Templates.NewsArticle.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.NewsArticle.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.NewsArticle.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Feature/News/code/Views/News/NewsMetadata.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@model Sitecore.Mvc.Presentation.RenderingModel

@if (!Model?.Item?.IsDerived(Templates.NewsArticle.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.NewsArticle.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.NewsArticle.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Feature/News/code/Views/News/NewsPageHeader.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@using Sitecore.Foundation.Alerts.Extensions
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@model Sitecore.Mvc.Presentation.RenderingModel
@if (!Model?.Item?.IsDerived(Templates.NewsArticle.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.NewsArticle.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.NewsArticle.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Feature/News/code/Views/News/NewsTeaser.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Repositories
@using Sitecore.Foundation.Theming.Extensions
@model Sitecore.Mvc.Presentation.RenderingModel
@if (!Model?.Item?.IsDerived(Templates.NewsArticle.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.NewsArticle.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.NewsArticle.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@{
const int DefaultColumns = 4;

var children = Model.Item.Children.Where(i => i.IsDerived(Templates.HasPageContent.ID) && i.HasContextLanguage()).ToArray();
var children = Model.Item.Children.Where(i => i.DescendsFrom(Templates.HasPageContent.ID) && i.HasContextLanguage()).ToArray();
var numColumns = children.Length >= DefaultColumns ? DefaultColumns : (children.Length <= 2 ? 2 : children.Length);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@using Sitecore.Foundation.Alerts.Extensions
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@model Sitecore.Mvc.Presentation.RenderingModel
@if (!Model?.Item?.IsDerived(Templates.HasPageContent.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.HasPageContent.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasPageContent.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@model Sitecore.Mvc.Presentation.RenderingModel

@if (!Model?.Item?.IsDerived(Templates.HasPageContent.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.HasPageContent.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasPageContent.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Repositories
@model Sitecore.Mvc.Presentation.RenderingModel

@if (!Model?.Item?.IsDerived(Templates.HasPageContent.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.HasPageContent.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasPageContent.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@model Sitecore.Mvc.Presentation.RenderingModel

@if (!Model?.Item?.IsDerived(Templates.HasPageContent.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.HasPageContent.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.HasPageContent.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@using Sitecore.Foundation.SitecoreExtensions.Extensions
@model Sitecore.Mvc.Presentation.RenderingModel

@if (!Model?.Item?.IsDerived(Templates.Employee.ID) ?? true)
@if (!Model?.Item?.DescendsFrom(Templates.Employee.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.Employee.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@{

if (!Model?.Item?.IsDerived(Templates.Employee.ID) ?? true)
if (!Model?.Item?.DescendsFrom(Templates.Employee.ID) ?? true)
{
@Html.PageEditorError(AlertTexts.InvalidDataSourceTemplate(Templates.Employee.ID), AlertTexts.InvalidDataSourceTemplateFriendlyMessage, Model.Item?.ID, Model.Rendering.Item?.ID)
return;
Expand Down
Loading

0 comments on commit 17b8955

Please sign in to comment.