@Umbraco.GetDictionaryValue("createdOn", "Date Created"): @Model.CreateDate
``` - -## Templating Helpers - -### .RenderMacro(string alias, object parameters) - -Renders a macro in the current page content, given the macro's alias, and parameters required by the macro. - -```csharp -@await Umbraco.RenderMacroAsync("navigation", new {root="1083", header="Hello"}) -``` - -### .RenderTemplateAsync(int contentId, int? altTemplateId) - -Renders a template asynchronously, as if a page with the given contentId was requested, optionally with an alternative template ID passed in. - -```csharp -@await Umbraco.RenderTemplate(1234) -``` diff --git a/14/umbraco-cms/reference/security/two-factor-authentication.md b/14/umbraco-cms/reference/security/two-factor-authentication.md index cda029a3265..4d8ea084733 100644 --- a/14/umbraco-cms/reference/security/two-factor-authentication.md +++ b/14/umbraco-cms/reference/security/two-factor-authentication.md @@ -10,7 +10,7 @@ Two-factor authentication (2FA) for Umbraco members is activated by implementing ## Two-factor authentication for Members -Since Umbraco does not control how the UI is for member login and profile edit. The UI for 2FA is shipped as part of the snippets for macros. These can be used as a starting point, before styling the page as you would like. +Since Umbraco does not control how the UI is for member login and profile edit. The UI for 2FA is shipped as part of the Partial View snippets. These can be used as a starting point, before styling the page as you would like. ### Example implementation for Authenticator Apps for Members @@ -180,7 +180,7 @@ In this razor-code sample, we get the current member's unique key and list all r If the `setupData` is `null` for the specified `providerName` it means the provider is already set up. In this case, we show a disable button. Otherwise, we check the type and show the UI for how to set up the App Authenticator. We will show the QR Code and an input field to validate the code from the App Authenticator. -The last part required is to use the `Login` Partial Macro snippet. +The last part required is to use the `Login` Partial View snippet. ### Notification when 2FA is requested for a member diff --git a/14/umbraco-cms/reference/templating/README.md b/14/umbraco-cms/reference/templating/README.md index 30916714b1e..707d730f68e 100644 --- a/14/umbraco-cms/reference/templating/README.md +++ b/14/umbraco-cms/reference/templating/README.md @@ -1,16 +1,14 @@ --- description: >- - Information on configuring Templates (Views), Partials (Partial Views) and - Macros (Macro Partials) + Information on configuring Templates (Views) and Partials (Partial Views) --- # Templating -Templating in Umbraco consists of 3 larger concepts, namely Templates (Views), Partials (Partial Views) and Macros (Macro Partials): +Templating in Umbraco consists of 3 larger concepts, namely Templates (Views) and Partials (Partial Views). * Templates are used for the HTML layout of your pages. * Partials can be included in your templates for shared functionality across different page templates. -* Macros can be used for reusable dynamic components that can be controlled by editors to embed functionality into the grid or rich text areas. ## Templating technology @@ -24,10 +22,6 @@ The WebForms (masterpages) and Dynamic Razor approaches to templating are still Describes how to work with MVC views, the razor syntax and APIs available. It also describes how to create forms, has some step-by-step guides and other advanced techniques. -## [Macros](macros/) - -Describes how to set up a macro, use macro parameters & configuring caching. Defines the different types of macros and provides details on the different macro engine APIs and their usage. - ## [Models Builder](modelsbuilder/) A tool that can generate a complete set of strongly-typed published content models for Umbraco. Models are available in controllers, views, anywhere. Runs either from the Umbraco UI, from the command line, or from Visual Studio. diff --git a/14/umbraco-cms/reference/templating/macros/README.md b/14/umbraco-cms/reference/templating/macros/README.md deleted file mode 100644 index bb6975cfb50..00000000000 --- a/14/umbraco-cms/reference/templating/macros/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# Macros - -_Describes how to set up a macro, use macro parameters & configuring caching. Defines the different types of macros and provides details on the different macro engine APIs and their usage_ - -## What is a macro - -A macro is 'wrapper' for a reusable piece of functionality that you can utilise in different places throughout your site. - -You can use macros in your templates, like MVC Partial views - however they differ in that they can be configured to work with Parameters and Caching, that can be updated by editors via the Umbraco Backoffice. So if you allow a macro to be added to a Rich Text Editor or Grid cell, the editor, at the point of inserting the macro can supply the parameter values. - -For example imagine adding an Image Gallery within a rich text editor, and at the point of insertion 'picking' the images to display. - - - -Define the parameters - - - -Using in a Rich Text Area - -A Rich Text Editor should be enabled with macros in the toolbar to allow inserting macros. - - - -Rich Text Area with macro toolbar option - - - -Insert the macro into a Rich Text Area - - - -The same implementation logic can be used in lots of different places on your site, and the editor can customise the output by choosing different parameters. - -## Implementing a Macro - -Macros can be implemented using an MVC Partial View - [Partial View Macros](partial-view-macros.md). It uses the exact same syntax and objects as [MVC views](../mvc/). - -## Rendering Macros - -Here's a basic method to render macros: - -```csharp -@await Umbraco.RenderMacroAsync("myMacroAlias") -``` - -### Rendering Macros with Parameters - -This renders a macro with some parameters using an anonymous object: - -```csharp -@await Umbraco.RenderMacroAsync("myMacroAlias", new { name = "Ned", age = 28 }) -``` - -This renders a macro with some parameters using a dictionary - -```csharp -@await Umbraco.RenderMacroAsync("myMacroAlias", new Dictionary