Skip to content

Instantly share code, notes, and snippets.

@5up3rman
5up3rman / Wrapper.config
Created June 29, 2017 19:20
Wrapper, Marker Example Config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<mvc.renderRendering>
<processor type="EditorEnhancementToolkit.Foundation.ContentEditor.Pipelines.RenderRenderer.InjectExperiencEditorAssets,EditorEnhancementToolkit.Foundation.ContentEditor">
<styles hint="list:addStyleResource">
<resource>/sitecore modules/Shell/Editor Enhancement Toolkit/Resources/EditorEnhancementToolkit.css</resource>
</styles>
</processor>
<processor type="Sitecore.Mvc.ExperienceEditor.Pipelines.Response.RenderRendering.AddWrapper, Sitecore.Mvc.ExperienceEditor" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer, Sitecore.Mvc']"/>
@5up3rman
5up3rman / InjectExperiencEditorAssets.cs
Created June 29, 2017 19:02
Inject Experienc Editor Assets Code
using System.Collections.Generic;
using System.IO;
using Sitecore.Mvc.Pipelines.Response.RenderRendering;
namespace EditorEnhancementToolkit.Foundation.ContentEditor.Pipelines.RenderRenderer
{
public class InjectExperiencEditorAssets : RenderRenderingProcessor
{
private const string CssLinkPattern = @"<link href=""{0}"" rel=""stylesheet"" />";
private readonly IList<string> StyleSheetList = new List<string>();
@5up3rman
5up3rman / InjectExperienceEditorAssets.config
Last active June 29, 2017 19:01
Inject Experience Editor Assets Configuration
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<processor type="EditorEnhancementToolkit.Foundation.ContentEditor.Pipelines.RenderRenderer.InjectExperiencEditorAssets,EditorEnhancementToolkit.Foundation.ContentEditor">
<styles hint="list:addStyleResource">
<resource>/sitecore modules/Shell/Editor Enhancement Toolkit/Resources/EditorEnhancementToolkit.css</resource>
</styles>
</processor>
</pipelines>
</sitecore>
@5up3rman
5up3rman / SetAdditionalFieldInformation.cs
Created June 28, 2017 21:01
Custom Rule Action: SetAdditionalFieldInformation
using EditorEnhancementToolkit.Foundation.ContentEditor.Enum;
using EditorEnhancementToolkit.Foundation.ContentEditor.ItemMapping;
using Sitecore.Rules.Actions;
namespace EditorEnhancementToolkit.Foundation.ContentEditor.Rules.Actions
{
public class SetAdditionalFieldInformation<T> : RuleAction<T> where T : ContentEditorRuleContext
{
public string FieldName { get; set; }
public string Text { get; set; }
@5up3rman
5up3rman / RenderAdditionalFieldInformation.cs
Last active June 28, 2017 20:59
RenderAdditionalFieldInformation Example
using System;
using System.Linq;
using System.Text;
using EditorEnhancementToolkit.Foundation.ContentEditor.Enum;
using EditorEnhancementToolkit.Foundation.ContentEditor.Rules;
using Sitecore.Configuration;
using Sitecore.Pipelines.RenderField;
namespace EditorEnhancementToolkit.Foundation.ContentEditor.Pipelines.RenderField
{
@5up3rman
5up3rman / PtagCorrectlyRendered.html
Created June 9, 2017 00:23
Glass's Editable Method Correctly Rendered
<span class="scChromeData">{"commands":[{"click":"chrome:field:editcontrol({command:\"webedit:edithtml\"})","header":"Edit Text","icon":"/temp/iconcache/office/16x16/pencil.png","disabledIcon":"/temp/pencil_disabled16x16.png","isDivider":false,"tooltip":"Edit the text","type":null},{"click":"chrome:field:execute({command:\"bold\", userInterface:true, value:true})","header":"","icon":"/temp/iconcache/office/16x16/font_style_bold.png","disabledIcon":"/temp/font_style_bold_disabled16x16.png","isDivider":false,"tooltip":"Bold","type":null},{"click":"chrome:field:execute({command:\"Italic\", userInterface:true, value:true})","header":"","icon":"/temp/iconcache/office/16x16/font_style_italics.png","disabledIcon":"/temp/font_style_italics_disabled16x16.png","isDivider":false,"tooltip":"Italic","type":null},{"click":"chrome:field:execute({command:\"Underline\", userInterface:true, value:true})","header":"","icon":"/temp/iconcache/office/16x16/font_style_underline.png","disabledIcon":"/temp/font_style_underline_disabl
@5up3rman
5up3rman / PtagIssue.html
Created June 9, 2017 00:18
Glass's Editable Method Wrapped with a P Tag
<p>
<span class="scChromeData">{"commands":[{"click":"chrome:field:editcontrol({command:\"webedit:edithtml\"})","header":"Edit Text","icon":"/temp/iconcache/office/16x16/pencil.png","disabledIcon":"/temp/pencil_disabled16x16.png","isDivider":false,"tooltip":"Edit the text","type":null},{"click":"chrome:field:execute({command:\"bold\", userInterface:true, value:true})","header":"","icon":"/temp/iconcache/office/16x16/font_style_bold.png","disabledIcon":"/temp/font_style_bold_disabled16x16.png","isDivider":false,"tooltip":"Bold","type":null},{"click":"chrome:field:execute({command:\"Italic\", userInterface:true, value:true})","header":"","icon":"/temp/iconcache/office/16x16/font_style_italics.png","disabledIcon":"/temp/font_style_italics_disabled16x16.png","isDivider":false,"tooltip":"Italic","type":null},{"click":"chrome:field:execute({command:\"Underline\", userInterface:true, value:true})","header":"","icon":"/temp/iconcache/office/16x16/font_style_underline.png","disabledIcon":"/temp/font_style_underline_
@5up3rman
5up3rman / ChooseLivePhotoMovie.cs
Last active May 18, 2017 20:48
Live Photo WebEdit Button: Choose Live Photo Movie
using System;
using Paragon.Foundation.LivePhoto.Data.Fields;
using Sitecore;
using Sitecore.Data.Items;
using Sitecore.Exceptions;
using Sitecore.Globalization;
using Sitecore.Shell.Applications.ContentEditor;
using Sitecore.Shell.Applications.Dialogs.MediaBrowser;
using Sitecore.Shell.Applications.WebEdit.Commands;
using Sitecore.Shell.Framework.Commands;
@5up3rman
5up3rman / Demo.cshtml
Created May 10, 2017 08:31
Live Photo - Rendering the Live Photo
@Html.LivePhoto().RenderLivePhoto(Model.LivePhoto, x=>x.Photo, true, HtmlTextWriterTag.Span)
@5up3rman
5up3rman / HtmlHelperExtensions.cs
Last active May 18, 2017 20:49
Live Photo: A dreaded Static Method
using System.Web.Mvc;
using Glass.Mapper.Sc;
using Glass.Mapper.Sc.IoC;
using Paragon.Foundation.LivePhoto.Mvc;
namespace Paragon.Foundation.LivePhoto
{
public static class HtmlHelperExtensions
{
public static LivePhotoMvc<T> LivePhoto<T>(this HtmlHelper<T> htmlHelper)