Skip to content

Instantly share code, notes, and snippets.

@jammykam
jammykam / ExtractPostProcessDllFromPackage.cs
Created September 20, 2017 22:05
Extract DLLs from TDS Update Packages
using Ionic.Zip;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Comcast.ExtractPostProcessDllFromPackage
{
@jammykam
jammykam / ServicesConfigurationRegistration.config
Last active November 12, 2017 13:10
A SwitchingLinkManager for Sitecore 8.2 allowing you to use a different LinkProvider per site
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<services>
<configurator type="Sitecore.Custom.Providers.ServicesConfigurator, Sitecore.Custom" />
</services>
</sitecore>
</configuration>
@jammykam
jammykam / EmailPlaceholder.cs
Last active October 4, 2017 18:03
Sitecore WFFM Email Field with Placeholder Text
using System.ComponentModel;
using Sitecore.Form.Core.Attributes;
namespace MyProject.CMS.Custom.WFFM.Fields
{
public class EmailPlaceholder : Sitecore.Form.Web.UI.Controls.Email
{
public new string Text
{
get { return this.textbox.Text; }
@jammykam
jammykam / PlaceholderInput.cs
Created October 4, 2017 18:07
Sitecore WFFM Input field with Placeholder
using System.ComponentModel;
using Sitecore.Form.Core.Attributes;
namespace MyProject.CMS.Custom.WFFM.Fields
{
public class PlaceholderInput : Sitecore.Form.Web.UI.Controls.SingleLineText
{
[DefaultValue("")]
[VisualCategory("Appearance")]
[VisualProperty("Placeholder Text:", 200)]
@jammykam
jammykam / CheckboxWithHtml.cs
Last active October 4, 2017 18:16
Sitecore WFFM Checkbox With HTML field
using Sitecore.Form.Core.Attributes;
using Sitecore.Form.Core.Visual;
namespace MyProject.CMS.Custom.WFFM.Fields
{
public class CheckboxWithHtml : Sitecore.Form.Web.UI.Controls.Checkbox
{
private string _htmlText;
[VisualCategory("Appearance")]

Create WFFM field in Sitecore under /sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types. For example:

  • Item Path: /sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types/Custom/Label
  • Template: /sitecore/templates/Web Forms for Marketers/Field Type
  • Assembly: MyProject.CMS.Custom
  • Class: MyProject.CMS.Custom.WFFM.Fields.Label
  • MVC Type: MyProject.CMS.Custom.WFFM.Fields.LabelField, MyProject.CMS.Custom
@jammykam
jammykam / HiddenToken.cs
Last active October 8, 2017 19:21
Sitecore WFFM Hidden Token Field
using System.ComponentModel;
using System.Web.UI;
using Sitecore.Form.Core.Attributes;
using Sitecore.Form.Core.Visual;
using Sitecore.Form.Web.UI.Controls;
namespace MyProject.CMS.Custom.WFFM.Fields.HiddenTokenField
{
public class HiddenToken : InputControl
{
Use master
GO
sp_configure 'show advanced options', 1
GO
RECONFIGURE WITH OVERRIDE
GO
sp_configure 'contained database authentication', 1
GO
RECONFIGURE WITH OVERRIDE
GO
@jammykam
jammykam / Attach.ImageCheckSize.cs
Last active November 27, 2019 13:26
Restrict Media Upload in Experience Editor and Content Editor in Sitecore 8.2 update-5. See following for further reference: https://stackoverflow.com/a/27956033/661447 | https://sitecore.stackexchange.com/q/9009/135 | https://sitecore.stackexchange.com/q/9060/135
using Sitecore;
using Sitecore.Exceptions;
using Sitecore.Pipelines.Attach;
namespace MyProject.MediaUpload.Pipelines.Attach
{
public class ImageCheckSize
{
public void Process(AttachArgs args)
{
@jammykam
jammykam / EditHtml.cs
Last active March 10, 2018 00:02
Extension to post by @rpeplau to resolve RTE tokens in Experience Editor mode for site specific purposes http://blog.peplau.com.br/en_US/site-specific-richtext-editor-profiles-custom-source-in-native-richtext-fields/
using Sitecore;
using Sitecore.Data.Fields;
using Sitecore.Diagnostics;
using Sitecore.ExperienceEditor.Utils;
using Sitecore.Globalization;
using Sitecore.Shell.Applications.ContentEditor.RichTextEditor;
using Sitecore.Web.UI.Sheer;
namespace Konabos.RteSources.Commands
{