Skip to content

Instantly share code, notes, and snippets.

@jammykam
jammykam / CustomLookup.cs
Last active August 29, 2015 14:16
Custom Lookup Field with labels
using System;
using System.Collections.Specialized;
using System.Web;
using System.Web.UI;
using Sitecore;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Shell.Applications.ContentEditor;
using Sitecore.StringExtensions;
@jammykam
jammykam / ControlSources
Last active August 29, 2015 14:16
Custom Sitecore Control for storing Key/Value Data with Lookups
<configuration xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<controlSources>
<source mode="on" namespace="MyProject.Shell" assembly="MyProject" prefix="contentExtension"/>
</controlSources>
</sitecore>
</configuration>
@jammykam
jammykam / StringExtensions.tt
Created February 3, 2015 23:30
Hedgehog CodeGen - Glass Mapper v3
<#+
public static string TitleCase(string word)
{
string newWord = System.Text.RegularExpressions.Regex.Replace(word, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1+");
newWord = System.Globalization.CultureInfo.InvariantCulture.TextInfo.ToTitleCase(newWord);
newWord = newWord.Replace("+", "");
return newWord;
}
public static string CamelCase(string word)
@jammykam
jammykam / SwitchingLinkProvider
Last active September 21, 2017 02:57
Sitecore Site Specific Link Provider for up to SC 8.1
using System;
using System.Collections.Specialized;
using System.Web;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Links;
using Sitecore.Web;
namespace Sitecore.Custom.Links
@jammykam
jammykam / Attach.cs
Last active December 17, 2017 17:20
Restrict Media Upload in Content Editor in Sitecore 7.2
using LaunchSitecore.Applications;
using Sitecore;
using Sitecore.Exceptions;
using Sitecore.Pipelines.Attach;
using System;
using System.Collections.Generic;
namespace LaunchSitecore.Pipelines.Attach
{