Beispiel #1
0
        /// <summary>
        /// Gets the collection of all registered Lava document elements.
        /// </summary>
        /// <returns></returns>
        public static Dictionary <string, ILavaElementInfo> GetRegisteredElements()
        {
            if (_engine == null)
            {
                return(null);
            }

            return(_engine.GetRegisteredElements());
        }
        private static void RegisterEntityCommand(ILavaEngine engine, EntityTypeCache entityType, bool useQualifiedNameIfExists = false)
        {
            if (entityType != null)
            {
                string entityName = entityType.FriendlyName.RemoveSpaces().ToLower();

                // if entity name is already registered, use the full class name with namespace
                if (useQualifiedNameIfExists &&
                    engine.GetRegisteredElements().ContainsKey(entityName))
                {
                    entityName = entityType.Name.Replace('.', '_');
                }

                engine.RegisterBlock(entityName,
                                     (name) =>
                {
                    // Return a block having a tag name corresponding to the entity name.
                    return(new RockEntityBlock()
                    {
                        SourceElementName = entityName, EntityName = entityName
                    });
                });
            }
        }