Skip to content

Instantly share code, notes, and snippets.

@muso31
muso31 / SelectRendering.xml
Last active January 25, 2019 13:53
Sitecore placeholders as dropdown
<?xml version="1.0" encoding="utf-8" ?>
<control xmlns:def="Definition" xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense">
<Sitecore.Shell.Applications.Dialogs.SelectRendering>
<FormDialog ID="Dialog" Icon="Core/32x32/open_document.png" Header="Open Item"
Text="Select the item that you wish to open. Then click the Open button." OKButton="Open">
<Stylesheet Src="SelectItemWithThumbnails.css" DeviceDependant="true" />
<CodeBeside Type="Helixbase.Feature.Fun.SelectRenderingForm,Helixbase.Feature.Fun"/>
<DataContext ID="DataContext" Root="/"/>
@muso31
muso31 / Feature.ItemUnlock.config
Last active January 28, 2018 08:12
Unlock files when deleting a user
<sitecore>
<events>
<event name="user:deleted">
<handler type="Helixbase.Feature.ItemUnlock.Events.RemovedUserEventHandler, Helixbase.Feature.ItemUnlock" method="OnUserDeletedUnlockFiles" />
</event>
</events>
</sitecore>
@muso31
muso31 / ConfigMaps_Extensions.cs
Last active January 27, 2018 23:06
Auto registering controllers and Glass config maps
public static class MapsConfigFactoryExtension
{
public static void AddFluentMaps(this IConfigFactory<IGlassMap> mapsConfigFactory, params string[] assemblyFilters)
{
var assemblies = GetAssemblies.GetByFilter(assemblyFilters);
AddFluentMaps(mapsConfigFactory, assemblies);
}
public static void AddFluentMaps(this IConfigFactory<IGlassMap> mapsConfigFactory, params Assembly[] assemblies)
@muso31
muso31 / HeadingServiceFun.cs
Created December 17, 2017 09:14
Change Unicorn console images
using System;
using System.IO;
using System.Reflection;
using Unicorn.ControlPanel.Headings;
namespace Helixbase.Feature.Fun.Unicorn.Pipelines
{
public class HeadingServiceFun : HeadingService
{
private static readonly Random Random = new Random();
public HtmlString CreateEditableExample()
{
return new HtmlString(_glassHtml.Editable(item, i => i.SomeField,
new
{
EnclosingTag = "h2", // Wrap the field in <h2>
DisableWebEdit = false, // Disable or enable web edit
ShowTitleWhenBlank = "true" // Show the field title if field is empty
}));
}