From 2317d6a737a08727c3860522083a27d436a7664a Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sun, 26 Jul 2015 16:19:38 +0100 Subject: [PATCH] Update FrontEndCultureSelector shape template to accommodate home alias changes. --- .../Views/FrontEndCultureSelector.cshtml | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Localization/Views/FrontEndCultureSelector.cshtml b/src/Orchard.Web/Modules/Orchard.Localization/Views/FrontEndCultureSelector.cshtml index 60ca5ec8b..9e81a8d1f 100644 --- a/src/Orchard.Web/Modules/Orchard.Localization/Views/FrontEndCultureSelector.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Localization/Views/FrontEndCultureSelector.cshtml @@ -1,16 +1,15 @@ @using System.Globalization -@using Orchard.Alias +@using Orchard.Autoroute.Services @using Orchard.ContentManagement @using Orchard.ContentManagement.Aspects @using Orchard.Localization.Services @{ var localizableAspects = Enumerable.Empty(); - - var homePage = GetByPath(string.Empty); + var homePage = WorkContext.Resolve().GetHomePage(); if (homePage != null) { var localizationService = WorkContext.Resolve(); - localizableAspects = localizationService.GetLocalizations(homePage).Concat(new[] { homePage.As() }); + localizableAspects = localizationService.GetLocalizations(homePage).Concat(new[] { homePage.As() }); } } @if (localizableAspects.Any()) { @@ -30,22 +29,4 @@ } -} -@functions{ - public IContent GetByPath(string aliasPath) { - var contentRouting = WorkContext.Resolve().Get(aliasPath); - - if (contentRouting == null) - return null; - - object id; - if (contentRouting.TryGetValue("id", out id)) { - int contentId; - if (int.TryParse(id as string, out contentId)) { - return WorkContext.Resolve().Get(contentId); - } - } - - return null; - } -} +} \ No newline at end of file