/// <summary>
        /// Gets a shortcode definition for the specified shortcode name.
        /// </summary>
        /// <param name="shortcodeName"></param>
        /// <returns></returns>
        public static DynamicShortcodeDefinition GetShortcodeDefinition(string shortcodeName)
        {
            DynamicShortcodeDefinition newShortcode = null;

            var shortcodeDefinition = LavaShortcodeCache.All().Where(c => c.TagName != null && c.TagName.Equals(shortcodeName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

            if (shortcodeDefinition == null)
            {
                return(null);
            }

            newShortcode = new DynamicShortcodeDefinition();

            newShortcode.Name           = shortcodeDefinition.Name;
            newShortcode.TemplateMarkup = shortcodeDefinition.Markup;

            var parameters = RockSerializableDictionary.FromUriEncodedString(shortcodeDefinition.Parameters);

            newShortcode.Parameters = new Dictionary <string, string>(parameters.Dictionary);

            newShortcode.EnabledLavaCommands = shortcodeDefinition.EnabledLavaCommands.SplitDelimitedValues(",").ToList();

            if (shortcodeDefinition.TagType == TagType.Block)
            {
                newShortcode.ElementType = LavaShortcodeTypeSpecifier.Block;
            }
            else
            {
                newShortcode.ElementType = LavaShortcodeTypeSpecifier.Inline;
            }

            return(newShortcode);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a formatted string where the keys and values are Uri-encoded.
 /// </summary>
 /// <returns></returns>
 public string ToUriEncodedString()
 {
     return(RockSerializableDictionary.ToUriEncodedString(_dictionary));
 }