public static HtmlString DynamicPlaceholder(this SitecoreHelper helper, string placeholderName, ID placeholderSuffix) { Assert.ArgumentNotNull(placeholderName, nameof(placeholderName)); helper.CurrentRendering.Parameters[GetUniqueIdKeyWithinRendering.RenderingParameterKey] = placeholderSuffix.ToString(); return(helper.DynamicPlaceholder(new DynamicPlaceholderDefinition(placeholderName))); }
private static HtmlTag ApplyDynamicPlaceholderSyntax(SitecoreHelper helper, HtmlTag tag) { var match = DynamicPlaceholderRegex.Match(tag.Text); if (match.Success) { var placeholderKey = match.Groups["placeholderKey"].Value; var parameters = ParseParameters(match.Groups["parameters"].Value); var count = MainUtil.GetInt(parameters["count"], 1); var maxCount = MainUtil.GetInt(parameters["maxCount"], 0); var seed = MainUtil.GetInt(parameters["seed"], 0); var placeholder = helper.DynamicPlaceholder(placeholderKey, count, maxCount, seed).ToString(); tag.Text = DynamicPlaceholderRegex.Replace(tag.Text, placeholder); } return(tag); }
public static ReactPlaceholder GetPlaceholder(string placeholderName, HtmlHelper htmlHelper, bool isDynamic) { var scHelper = new SitecoreHelper(htmlHelper); var placeholder = isDynamic ? scHelper.DynamicPlaceholder(placeholderName) : scHelper.Placeholder(placeholderName); Regex regex = new Regex(@"key='(.[^']+)'");; if (!Sitecore.Context.PageMode.IsExperienceEditor) { regex = new Regex(@"id=""(.[^""]+)"""); } Match match = regex.Match(placeholder.ToString()); string key = match.Groups[1].Value; //todo: find out if we can get the original placeholder keys via Sitecore.Context.Page.Renderings... return(new ReactPlaceholder() { PlaceholderKey = key, Placeholder = placeholder.ToString(), IsDynamic = isDynamic }); }
public static HtmlString DynamicPlaceholder(this SitecoreHelper helper, string placeholderName, string className, int count) { return(helper.DynamicPlaceholder(placeholderName, CreateColumnWrapper(className), count: count)); }
public static HtmlString DynamicPlaceholder(this SitecoreHelper helper, string placeholderName, bool useStaticPlaceholderNames = false) { return(useStaticPlaceholderNames ? helper.Placeholder(placeholderName) : helper.DynamicPlaceholder(placeholderName)); }
public static HtmlString DynamicPlaceholder(this SitecoreHelper helper, string placeholderName) { return(helper.DynamicPlaceholder(placeholderName, false)); }