Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add doc for Inline Macro #4971
Add doc for Inline Macro #4971
Changes from all commits
0615485
439993b
e456e9f
a7b43b1
b647942
2db6ded
eb5f01b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Managing macros
In this article you can learn how to create and update a Macro, as well as how to configure its parameters.
Creating macros
There are a couple of ways to create a macro.
Manually
The first way is to manually create a macro, by right-clicking the Macro folder in the Settings section:
Give it a name in the dialog screen, and you'll be presented with the macro editor.
Partial View Macro files
The second option is to create the macro through Partial View Macro Files.
The dialog provides the following options:
Macro Editor
The macro editor view comes with a set of configuration options.
Macro partial view
Associate the macro with a partial view. This will already have been configured if you created the macro through the second option described above, where a Partial view was created along with the macro.
Editor settings
If selected will allow an editor to insert this macro in to a Rich Text Editor and/or into a Grid editor.
Caching options
Defines how many seconds the macro output will be cached for once it is rendered
If selected, then the macro will be cached based on the current page it is rendered on. This is useful if your macro has content that is dynamic to the current page it is being rendered on. If your macro's output is static (the same) no matter what page it is rendered on then it is better to not check this box.
Similar to the 'Cache by page', this will cache the output of a macro based on a member that is logged in. If your macro is static (the same) no matter what member is logged in, or if your website does not have membership then it is better to not check this box.
Macro parameters
Macro parameters can be used to change the output of a macro at runtime. Macro parameters are often used as a way for your editors to change the output of a macro when they insert them into rich text editors. As an example, suppose you have a widget that displays a list of links which are children of a particular content item. You could define a macro parameter that indicates for which content item to render child links for and your editor can select this content item when inserting the macro into the rich text editor.
The macro parameter dialog looks like this:
Here you can add/modify/remove macro parameters.
Default macro parameter types
This list defines the different types of macro parameters:
Umbraco.TrueFalse
) - A true/false valuecontentType
) - Choose a type from existing Document TypesUmbraco.Decimal
) - accepts only numbersUmbraco.EmailAddress
) - validates to valid email adressesUmbraco.MultiNodeTreePicker
) - pick 1 or more nodes from the Content treecontentTypeMultiple
) - pick 1 or more types from existing Document TypesUmbraco.MultipleMediaPicker
) - pick 1 or more media itemspropertyTypePickerMultiple
) - pick 1 or more from existing property typestabPickerMultiple
) - pick 1 or more from existing tabsUmbraco.Integer
) - accepts only numberspropertyTypePicker
) - choose property from existing property typestabPicker
) - select 1 from list of existing tabsUmbraco.TextArea
) - multiple lines of textUmbraco.TextBox
) - single line of textUmbraco.MediaPicker
) - select a single media itemUmbraco.ContentPicker
) - select a single content node from the Content treeUmbracoForms.FormsPicker
) - choose from exising Umbraco FormsUmbracoForms.ThemePicker
) - choose from existing Forms ThemesEnable Inline Macro
In some case you want to have the macro in the middle of a sentence.
To enable editors to add the macro inline, follow these steps:
Umbraco.TrueFalse
) as the type.The next time you add the macro, enable the new parameter to add the macro inline.
Enable Inline Macro by default on a macro
In some cases, you want to have a checkbox that is enabled by default. This would enable you to create your own type of macro parameter that has 1 as the default value. To achieve this, create a DataEditor class anywhere in your Umbraco Project with the following definition:
{% hint style="info"%} You can create a MacroParameter however you want, the importance is to have a parameter called enableInlineMacro with the value 1 to enable it. {% endhint %}