This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<pipelines> | |
<publishItem> | |
<processor patch:after="*[@type='Sitecore.Publishing.Pipelines.PublishItem.PerformAction, Sitecore.Kernel']" type="MyAssembly.VersionToPublish, MyAssembly"/> | |
</publishItem> | |
</pipelines> | |
</sitecore> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EvaluateResult : PublishItemProcessor | |
{ | |
public override void Process(PublishItemContext context) | |
{ | |
Assert.ArgumentNotNull(context, "context"); | |
// We want to rely on smart publishing so we don't send unnecessary data. Deletes are a weird sceneiro. | |
// If a Republish is performed, we need the delete actions to come through. We cant rely on the Result.Operation for this. | |
if ((context.Action != PublishAction.DeleteTargetItem || context.PublishOptions.CompareRevisions) && | |
(context.Result.Operation == PublishOperation.Skipped || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Web.UI; | |
using Sitecore; | |
using Sitecore.Configuration; | |
using Sitecore.Data; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; | |
using Sitecore.IO; | |
using Sitecore.Links; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ISP: Comcast | |
# Router: Ubiquiti EdgeMax Router Lite | |
# EdgeOS System Image: v1.7.0 | |
# WAN Interface: eth1 | |
# LAN Interface: eth0 (mgmt) | |
# VLAN Interface: eth0.2 (video) | |
# VLAN Interface: eth0.3 (voip) | |
# VLAN Interface: eth0.4 (local) | |
# VLAN Interface: eth0.5 (guest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Content() | |
{ | |
var spanish = LanguageManager.GetLanguage("es"); | |
var english = LanguageManager.GetLanguage("en"); | |
using (new LanguageItemFallback(spanish, english)) | |
{ | |
var model = GetContextItem<IContentGlass>(); | |
return View(model); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class GlassMapperScCustom | |
{ | |
public static IDependencyResolver CreateResolver() | |
{ | |
var config = new Glass.Mapper.Sc.Config(); | |
var resolver = new DependencyResolver(config); | |
// Add ResolveItemTask at the beginning of the Configuration Resolver. | |
resolver.ConfigurationResolverFactory.Insert(0, () => new ResolveItemTask()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ResolveItemTask : IConfigurationResolverTask | |
{ | |
public void Execute(ConfigurationResolverArgs args) | |
{ | |
// Don't impact out of the box functionality for the page editor. | |
if (Sitecore.Context.PageMode.IsPageEditorEditing) | |
return; | |
var context = (SitecoreTypeCreationContext)args.AbstractTypeCreationContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LanguageItemFallbackState | |
{ | |
public IEnumerable<Language> Languages { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LanguageItemFallback : Switcher<LanguageItemFallbackState> | |
{ | |
private readonly VersionCountDisabler _versionCountDisabler; | |
public LanguageItemFallback(params Language[] languages) : this(new LanguageItemFallbackState { Languages = languages } ) | |
{ | |
} | |
public LanguageItemFallback(LanguageItemFallbackState state) : base(state) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GeneralController : GlassController | |
{ | |
public ActionResult Content() | |
{ | |
var english = LanguageManager.GetLanguage("en"); | |
using (new LanguageItemFallback(english)) | |
{ | |
var model = GetContextItem<IContent>(inferType:true); | |
return View(model); | |
} |