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
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
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 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
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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<pipelines> | |
<expandInitialFieldValue> | |
<processor type="CustomExpandTokenProcessors.Pipelines.MyCustomTokenReplacer, CustomExpandTokenProcessors" patch:after="processor[@type='type=Sitecore.Pipelines.ExpandInitialFieldValue.ReplaceVariables, Sitecore.Kernel']"/> | |
</expandInitialFieldValue> | |
</pipelines> | |
</sitecore> | |
</configuration> |
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) |
OlderNewer