Created
April 14, 2015 15:11
-
-
Save dampee/a77654eef93df7322753 to your computer and use it in GitHub Desktop.
create umbraco macro with custom properties
This file contains hidden or 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 old namespace to create Macro, since Umbraco.Core.Models.Macro is still an internal class in Umbraco V7.1.8 | |
var macro = new Macro.Macro { Alias = alias, Name = name, ScriptingFile = scriptingFile, UseInEditor = useInEditor, RenderContent = renderContent }; | |
macro.Save(); | |
var newMacro = Services.MacroService.GetByAlias(alias); | |
foreach (var macroProperty in macroProperties) | |
{ | |
newMacro.Properties.Add(macroProperty); | |
} | |
Services.MacroService.Save(newMacro); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment