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
SiteContext targetSiteContext = SiteContext.GetSite(sitename); | |
using (var context = new SiteContextSwitcher(targetSiteContext)) | |
{ | |
// do something on the new site context | |
Item myItem = context.Database.GetItem("ID"); | |
} |
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 TemplateItemExtensions | |
{ | |
public static IEnumerable<TemplateFieldItem> GetFieldsOfSelfAndBaseTemplates(this TemplateItem self) | |
{ | |
var templateFieldItems = new Dictionary<ID, TemplateFieldItem>(); | |
GetAllFieldsForTemplate(self, templateFieldItems); | |
return templateFieldItems.Values; | |
} |
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
Template template = TemplateManager.GetTemplate(new ID(""), Sitecore.Context.Database); | |
TemplateField[] allFields = template.GetFields(true); |
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 Sitecore.Form.Core.Attributes; | |
using System; | |
using System.ComponentModel; | |
using System.Web.UI; | |
namespace CustomWFFM.CustomFieldTypes | |
{ | |
[ValidationProperty("Text")] | |
public class SingleLineTextWithPlaceholderField : Sitecore.Form.Web.UI.Controls.SingleLineText | |
{ |
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.ComponentModel; | |
using Sitecore.Data.Items; | |
namespace CustomWFFM.CustomFieldTypes.Mvc | |
{ | |
public class SingleLineTextWithPlaceholderField : Sitecore.Forms.Mvc.Models.Fields.SingleLineTextField | |
{ | |
[DefaultValue("")] | |
public string PlaceholderText { 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
@using Sitecore.Mvc | |
@model CustomWFFM.CustomFieldTypes.Mvc.SingleLineTextWithPlaceholderField | |
@if (!Model.Visible) | |
{ | |
return; | |
} | |
<div class="@Model.CssClass field-border"> |
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.Linq; | |
using Sitecore.Configuration; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; | |
using Sitecore.Pipelines.ExpandInitialFieldValue; | |
namespace CustomExpandTokenProcessors.Pipelines | |
{ | |
public class NextSortOrderReplacer : ExpandInitialFieldValueProcessor | |
{ |
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 Sitecore.Diagnostics; | |
using Sitecore.Pipelines.ExpandInitialFieldValue; | |
namespace CustomExpandTokenProcessors.Pipelines | |
{ | |
public class CustomTokenReplacer : ExpandInitialFieldValueProcessor | |
{ | |
private const string Token = "$customtoken"; | |
public override void Process(ExpandInitialFieldValueArgs args) |
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.Text.RegularExpressions; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; | |
using Sitecore.Pipelines.ExpandInitialFieldValue; | |
namespace CustomExpandTokenProcessors.Pipelines | |
{ | |
public class QueryTokenReplacer : ExpandInitialFieldValueProcessor | |
{ |
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
// Decompiled with JetBrains decompiler | |
// Type: Sitecore.Sites.SiteContext | |
// Assembly: Sitecore.Kernel, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null | |
// | |
// NOTE: This is not the complete implementation, only fractions of the important parts related | |
// to getting cookie by key from the site-context. | |
// | |
namespace Sitecore.Sites | |
{ |
OlderNewer