diff --git a/13/umbraco-cms/extending/health-check/guides/macroerrors.md b/13/umbraco-cms/extending/health-check/guides/macroerrors.md index 8bc67179126..1442f9422f1 100644 --- a/13/umbraco-cms/extending/health-check/guides/macroerrors.md +++ b/13/umbraco-cms/extending/health-check/guides/macroerrors.md @@ -2,6 +2,10 @@ _Checks to make sure macro errors are not set to throw a YSOD (yellow screen of death), which would prevent certain or all pages from loading completely._ +{% hint style="warning" %} +Macros will be removed in the next version. Consider using Partial Views or Blocks in Rich Text Editor. +{% endhint %} + ## How to fix this health check This health check can be fixed by providing configuration on the following path: `Umbraco:CMS:Content:MacroErrors`. diff --git a/13/umbraco-cms/extending/macro-parameter-editors.md b/13/umbraco-cms/extending/macro-parameter-editors.md index f21980ba626..bfc0e444a1a 100644 --- a/13/umbraco-cms/extending/macro-parameter-editors.md +++ b/13/umbraco-cms/extending/macro-parameter-editors.md @@ -4,8 +4,8 @@ description: A guide to creating macro property editors in Umbraco # Macro Parameter Editors -{% hint style="info" %} -The samples in this article has not been verified against the latest version of Umbraco. +{% hint style="warning" %} +Macros will be removed in the next version. Consider using Partial Views or Blocks in Rich Text Editor. {% endhint %} Every macro can contain parameters. Options for the Editor to set when they insert the Macro to customise the output. There are some useful default types. For example: diff --git a/13/umbraco-cms/fundamentals/design/partial-view-macro-files.md b/13/umbraco-cms/fundamentals/design/partial-view-macro-files.md index 0403bcd2849..0605a545123 100644 --- a/13/umbraco-cms/fundamentals/design/partial-view-macro-files.md +++ b/13/umbraco-cms/fundamentals/design/partial-view-macro-files.md @@ -2,6 +2,10 @@ description: Information on working with partial view macro files in Umbraco --- +{% hint style="warning" %} +Partial View Macro Files will be removed in the next version. Consider using Partial Views. +{% endhint %} + # Partial View Macro Files A Macro is a reusable piece of functionality with some configuration options in the Backoffice. A Partial View Macro File (`.cshtml` file) is a specific file configuration that is associated with the Macro. A Partial View Macro File generates a Macro that can be inserted and rendered in the Grid and Rich Text Editor data types. Additionally, you can define parameter values and enable caching in Macros in the Backoffice. Partial View Macro Files are the recommended macro type to use in Umbraco. diff --git a/13/umbraco-cms/reference/management/services/macroservice.md b/13/umbraco-cms/reference/management/services/macroservice.md index 5eb5ea6331d..a26e3e158f3 100644 --- a/13/umbraco-cms/reference/management/services/macroservice.md +++ b/13/umbraco-cms/reference/management/services/macroservice.md @@ -1,5 +1,9 @@ # MacroService +{% hint style="warning" %} +MacrosService will be removed in the next version. +{% endhint %} + Defines the MacroService, which is an access to operations involving `IMacro`. [Browse the API documentation for IMacroService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IMacroService.html). diff --git a/13/umbraco-cms/reference/templating/macros/README.md b/13/umbraco-cms/reference/templating/macros/README.md index bb6975cfb50..89f68c31501 100644 --- a/13/umbraco-cms/reference/templating/macros/README.md +++ b/13/umbraco-cms/reference/templating/macros/README.md @@ -2,6 +2,10 @@ _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_ +{% hint style="warning" %} +Macros and Partial View Macros will be removed in the next version. Consider using Partial Views or Blocks in Rich Text Editor. +{% endhint %} + ## What is a macro A macro is 'wrapper' for a reusable piece of functionality that you can utilise in different places throughout your site. diff --git a/14/umbraco-cms/extending-cms/customize-the-editing-experience.md b/14/umbraco-cms/extending-cms/customize-the-editing-experience.md index d8461cfb254..f339875551d 100644 --- a/14/umbraco-cms/extending-cms/customize-the-editing-experience.md +++ b/14/umbraco-cms/extending-cms/customize-the-editing-experience.md @@ -18,7 +18,6 @@ In this section, you will find all the resources you need to build an intuitive * [Backoffice Search](backoffice-search.md) * [Content Apps](content-apps.md) * [Language files and localization](language-files.md) -* [Macro Parameter editors](macro-parameter-editors.md) ## Also in this section diff --git a/14/umbraco-cms/extending-cms/filesystemproviders/README.md b/14/umbraco-cms/extending-cms/filesystemproviders/README.md index 90117e07448..8118e35df94 100644 --- a/14/umbraco-cms/extending-cms/filesystemproviders/README.md +++ b/14/umbraco-cms/extending-cms/filesystemproviders/README.md @@ -152,7 +152,6 @@ And you could create your own logic for the path by implementing `IMediaPathSche Umbraco also registers instances of `PhysicalFileSystem` for the following parts of Umbraco that persist to 'files': -* `MacroPartialsFileSystem` * `PartialViewsFileSystem` * `StylesheetsFileSystem` * `ScriptsFileSystem` @@ -160,17 +159,6 @@ Umbraco also registers instances of `PhysicalFileSystem` for the following parts These are accessible via dependency injection. -```csharp -public class FileSystemLocations -{ - private readonly FileSystems _fileSystems; - public FileSystemLocations(FileSystems fileSystems) - { - _fileSystems = fileSystems; - var macroPartialsFileSystem = _fileSystems.MacroPartialsFileSystem; - } -``` - `IFileSystem`, `MediaFileManager`, and `FileSystems` are located in the `Umbraco.Cms.Core.IO` namespace. ### Stylesheet Filesystem diff --git a/14/umbraco-cms/extending-cms/health-check/README.md b/14/umbraco-cms/extending-cms/health-check/README.md index a06efcb67a1..ce8b4b87272 100644 --- a/14/umbraco-cms/extending-cms/health-check/README.md +++ b/14/umbraco-cms/extending-cms/health-check/README.md @@ -13,7 +13,6 @@ For inspiration when building your checks you can look at the checks we've [buil Umbraco comes with the following checks by default: * Category **Configuration** - * **Macro errors (id: `D0F7599E-9B2A-4D9E-9883-81C7EDC5616F`)** - checks that the errors are set to `inline` so that pages that error will still load (and shows a small error message) * **Notification Email Settings (id: `3E2F7B14-4B41-452B-9A30-E67FBC8E1206`)** - checks that the "from" email address used for email notifications has been changed from its default value * Category **Data Integrity** * **Database data integrity check (id: `73DD0C1C-E0CA-4C31-9564-1DCA509788AF`)** - checks for various data integrity issues in the Umbraco database @@ -70,97 +69,6 @@ These are small checks that take an [IConfiguration](https://docs.microsoft.com/ * `CheckSuccessMessage` and `CheckErrorMessage` are the messages returned to the user * It is highly recommended to use the `LocalizedTextService` so these can be localized. You can add the text in `~/Config/Lang/en-US.user.xml` (or whatever language you like) -An example check: - -```csharp -using Microsoft.Extensions.Options; -using Umbraco.Cms.Core.Configuration.Models; -using Umbraco.Cms.Core.Macros; -using Umbraco.Cms.Core.Services; -using Umbraco.Extensions; - -namespace Umbraco.Cms.Core.HealthChecks.Checks.Configuration; - -/// -/// Health check for the recommended production configuration for Macro Errors. -/// -[HealthCheck( - "D0F7599E-9B2A-4D9E-9883-81C7EDC5616F", - "Macro errors", - Description = "Checks to make sure macro errors are not set to throw a YSOD (yellow screen of death), which would prevent certain or all pages from loading completely.", - Group = "Configuration")] -public class MacroErrorsCheck : AbstractSettingsCheck -{ - private readonly ILocalizedTextService _textService; - private readonly IOptionsMonitor _contentSettings; - - /// - /// Initializes a new instance of the class. - /// - public MacroErrorsCheck( - ILocalizedTextService textService, - IOptionsMonitor contentSettings) - : base(textService) - { - _textService = textService; - _contentSettings = contentSettings; - } - - /// - public override string ReadMoreLink => Constants.HealthChecks.DocumentationLinks.Configuration.MacroErrorsCheck; - - /// - public override ValueComparisonType ValueComparisonType => ValueComparisonType.ShouldEqual; - - /// - public override string ItemPath => Constants.Configuration.ConfigContentMacroErrors; - - /// - /// Gets the values to compare against. - /// - public override IEnumerable Values - { - get - { - var values = new List - { - new AcceptableConfiguration - { - IsRecommended = true, - Value = MacroErrorBehaviour.Inline.ToString() - }, - new AcceptableConfiguration - { - IsRecommended = false, - Value = MacroErrorBehaviour.Silent.ToString() - } - }; - - return values; - } - } - - /// - public override string CurrentValue => _contentSettings.CurrentValue.MacroErrors.ToString(); - - /// - /// Gets the message for when the check has succeeded. - /// - public override string CheckSuccessMessage => - _textService.Localize( - "healthcheck","macroErrorModeCheckSuccessMessage", - new[] { CurrentValue, Values.First(v => v.IsRecommended).Value }); - - /// - /// Gets the message for when the check has failed. - /// - public override string CheckErrorMessage => - _textService.Localize( - "healthcheck","macroErrorModeCheckErrorMessage", - new[] { CurrentValue, Values.First(v => v.IsRecommended).Value }); -} -``` - ### General checks This can be anything you can think of, the results and the rectify action are completely under your control. diff --git a/14/umbraco-cms/extending-cms/health-check/guides/README.md b/14/umbraco-cms/extending-cms/health-check/guides/README.md index 3b9ef600b39..67647865643 100644 --- a/14/umbraco-cms/extending-cms/health-check/guides/README.md +++ b/14/umbraco-cms/extending-cms/health-check/guides/README.md @@ -6,7 +6,7 @@ Below is a list of guides for Health Checks in Umbraco. ## [Content sniffing protection](contentsniffingprotection.md) -## [Cross-site scription protection](crosssitescriptingprotection.md) +## [Cross-site scripting protection](crosssitescriptingprotection.md) ## [Debug compilation mode](debugcompilationmode.md) @@ -18,8 +18,6 @@ Below is a list of guides for Health Checks in Umbraco. ## [HTTPS configuration](httpsconfiguration.md) -## [Macro errors](macroerrors.md) - ## [Notification Email](notificationemail.md) ## [Simple Mail Transfer Protocol (SMTP)](smtp.md) diff --git a/14/umbraco-cms/extending-cms/health-check/guides/macroerrors.md b/14/umbraco-cms/extending-cms/health-check/guides/macroerrors.md deleted file mode 100644 index 8bc67179126..00000000000 --- a/14/umbraco-cms/extending-cms/health-check/guides/macroerrors.md +++ /dev/null @@ -1,39 +0,0 @@ -# Health check: Macro errors - -_Checks to make sure macro errors are not set to throw a YSOD (yellow screen of death), which would prevent certain or all pages from loading completely._ - -## How to fix this health check - -This health check can be fixed by providing configuration on the following path: `Umbraco:CMS:Content:MacroErrors`. - -This configuration can be setup in a configuration source of your choice. This guide shows how to set it up in one of the json file sources. - -### Updating the json configuration - -The following json needs to be merged into one of you json sources. By default the following json sources are used: `appSettings.json` and `appSettings..json`, e.g. `appSettings.Development.json` or `appSettings.Production.json`. - -```json -{ - "Umbraco": { - "CMS": { - "Content": { - "MacroErrors": "" - } - } - } -} -``` - -One example that can be used in production, but is not recommended for development: - -```json -{ - "Umbraco": { - "CMS": { - "Content": { - "MacroErrors": "Silent" - } - } - } -} -``` diff --git a/14/umbraco-cms/extending-cms/macro-parameter-editors.md b/14/umbraco-cms/extending-cms/macro-parameter-editors.md deleted file mode 100644 index f21980ba626..00000000000 --- a/14/umbraco-cms/extending-cms/macro-parameter-editors.md +++ /dev/null @@ -1,219 +0,0 @@ ---- -description: A guide to creating macro property editors in Umbraco ---- - -# Macro Parameter Editors - -{% hint style="info" %} -The samples in this article has not been verified against the latest version of Umbraco. -{% endhint %} - -Every macro can contain parameters. Options for the Editor to set when they insert the Macro to customise the output. There are some useful default types. For example: - -* True/False -* TextBox -* TextArea -* Numeric -* Single/Multiple Media Picker -* Single/Multiple Content Picker -* ... and some 'others' - -Consult the [Backoffice documentation](../fundamentals/backoffice/) for general information on Macros. - -It is possible to create custom macro parameter types. - -## Creating a custom Macro Parameter Type - -### isParameterEditor - -To create a custom Macro Parameter Type, first create a custom 'Property Editor' (or copy one from the core). See [Property Editors documentation](property-editors/) and in the corresponding [Package Manifest file](property-editors/package-manifest.md) for the editor, set the `isParameterEditor` property to be true. - -```json -{ - "propertyEditors": [ - { - "alias": "My.ParameterEditorAlias", - "name": "Parameter Editor Name", - "isParameterEditor": true, - "editor": { - "view": "/App_Plugins/My.ParameterEditor/ParameterEditorView.html" - } - } - ] -} -``` - -### PreValues/Configuration/DefaultValues - -However 'Parameter Editors' unlike 'Property Editors' cannot contain 'prevalues', since there is no UI to present configuration options in the Macro Parameter tab when a particular type is chosen. However using the `defaultConfig` option enables the passing of 'one off' default set of configuration for the parameter editor to use: - -```json -{ - "propertyEditors": [ - { - "alias": "My.ParameterEditorAlias", - ... - "defaultConfig": { - "startNode": "1234", - "minItems": 0, - "maxItems": 6 - } - } - ] -} -``` - -This is only a problem if you have a macro parameter type, that needs to be used on lots of different macros, but with slightly different configurations in each instance. - -### Example - -We'll create an 'Image Position' Macro Parameter type providing a Radio Button list of options for positioning an image that has been inserted via an 'Insert Image' Macro into a Rich Text Editor. - -#### Package Manifest - -```json -{ - "propertyEditors": [ - { - "alias": "Our.Umbraco.ImagePosition", - "name": "Image Position", - "isParameterEditor": true, - "editor": { - "view": "/App_Plugins/Our.Umbraco.ImagePosition/ImagePosition.html", - "valueType": "STRING" - } - } - ], - "javascript": [ - "/App_Plugins/Our.Umbraco.ImagePosition/ImagePosition.controller.js" - ] -} -``` - -#### View - -```html -
-
- -
-
-``` - -#### Controller - -```javascript -angular.module("umbraco").controller("Our.Umbraco.ImagePositionController", function ($scope) { - - if ($scope.model.value == null) { - $scope.model.value = 'FullWidth'; - } - - // could read positions from defaultConfig - $scope.positions = [ - { - Name: 'FullWidth' - }, - { - Name: 'Left' - }, - { - Name: 'Right' - }, - { - Name: 'Center' - } - ]; -}); -``` - -#### Display - -The final custom parameter should look like this: - -![Image Position Radio Button Options](../../../10/umbraco-cms/extending/images/image-position-v8.png) - -#### Using defaultConfig - -In this example it doesn't really add anything to move the radio button options into configuration, however to illustrate the concept of providing defaultConfig, let's do that: - -The package manifest becomes: - -```json -{ - "propertyEditors": [ - { - "alias": "Our.Umbraco.ImagePosition", - "name": "Image Position", - "isParameterEditor": true, - "editor": { - "view": "/App_Plugins/Our.Umbraco.ImagePosition/ImagePosition.html", - "valueType": "STRING" - }, - "prevalues": { - "fields": [ - { - "label": "Options", - "description": "Radio Button Options", - "key": "options", - "view": "textarea" - } - ] - }, - "defaultConfig": { - "options": [ - { - "Name": "FullWidth" - }, - { - "Name": "Lefty" - }, - { - "Name": "Righty" - }, - { - "Name": "Centerish" - } - ] - } - } - ], - "javascript": [ - "/App_Plugins/Our.Umbraco.ImagePosition/ImagePosition.controller.js" - ] -} -``` - -In the `ImagePosition.controller.js` we can now read the 'options' values from the `defaultConfig` in the package.manifest configuration: - -```javascript - $scope.positions = $scope.model.config.options; -``` - -### Reading the parameter value in the Macro Partial View - -```csharp -@using Umbraco.Extensions -@inherits Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage -@{ - var imagePosition = Model.MacroParameters["imagePosition"]; - //or if for convenience if you are using Umbraco.Extensions namespace there is a GetParameterValue extension method, which allows a default value to be specified if the parameter is not provided: - imagePosition = Model.GetParameterValue("imagePosition","full-width"); -} -``` - -### Runtime minification cache busting in Production - -If your custom property editor doesn't load when your project is deployed, you may need to modify your [Runtime Minification Settings](../reference/configuration/runtimeminificationsettings.md). The minified bundle cache may need to be "busted" to get your new code to load. For example, to bust the cache whenever the app is restarted, you can use this configuration: - -```json -"Umbraco": { - "CMS": { - "RuntimeMinification": { - "CacheBuster": "AppDomain" - } - } -} -``` diff --git a/14/umbraco-cms/extending-cms/packages/creating-a-package.md b/14/umbraco-cms/extending-cms/packages/creating-a-package.md index 57e24eca7b0..6254b568ce0 100644 --- a/14/umbraco-cms/extending-cms/packages/creating-a-package.md +++ b/14/umbraco-cms/extending-cms/packages/creating-a-package.md @@ -30,7 +30,6 @@ These values are used to determine which backoffice items the package should con | Media | _Empty_ | Here, you can include media - e.g. if you want to add media to the starter kit. Not relevant for this package though. | | Document Types | _Empty_ | Similar to the Content picker above. It is important to note that if you include content, you will need to also pick all its dependencies in this and the next steps for them to be packaged together! | | Media Types | _Empty_ | Similar to the Media picker above. It is important to note that if you include media, you will need to also pick all its dependencies in this and the next steps for them to be packaged together! | -| Macros | _Empty_ | See `Document Types` above | | Languages | _Empty_ | See `Document Types` above - all text is hardcoded or within our own lang folder in this package, so this is not needed. | | Dictionary | _Empty_ | See `Document Types` above | | Data Types | _Empty_ | See `Document Types` above | @@ -65,8 +64,6 @@ The files that we created from the [Creating a Custom Dashboard Tutorial](../../ - - diff --git a/14/umbraco-cms/extending-cms/packages/types-of-packages.md b/14/umbraco-cms/extending-cms/packages/types-of-packages.md index 7c1e8145a36..6007cb835e5 100644 --- a/14/umbraco-cms/extending-cms/packages/types-of-packages.md +++ b/14/umbraco-cms/extending-cms/packages/types-of-packages.md @@ -54,7 +54,6 @@ Packages zip files can contain: * Document Types * Templates * Stylesheets -* Macros * Languages * Dictionary Items * Data Types diff --git a/14/umbraco-cms/extending-cms/property-editors/declaring-your-property-editor.md b/14/umbraco-cms/extending-cms/property-editors/declaring-your-property-editor.md index 29d67fc01ac..8346f3c0c46 100644 --- a/14/umbraco-cms/extending-cms/property-editors/declaring-your-property-editor.md +++ b/14/umbraco-cms/extending-cms/property-editors/declaring-your-property-editor.md @@ -11,8 +11,7 @@ A property editor consists of a number of mandatory properties, and some optiona | `editor` | object | Yes | This describes details about the editor. See the table below for further information. | | `icon` | string | No | A CSS class for the icon to be used in the **Select Editor** dialog - eg: `icon-autofill`. | | `group` | string | No | The group to place this editor in within the **Select Editor** dialog. Use a new group name or alternatively use an existing one such as **Pickers**. | -| `isParameterEditor` | boolean | No | Enables the property editor as a macro parameter editor. Can be either `true` or `false` (default). | -| `defaultConfig` | object | No | Provides a collection of default configuration values, in cases the property editor is not configured or is used a parameter editor (which doesn't allow configuration). The object is a key/value collection and must match the prevalue fields keys. | +| `defaultConfig` | object | No | Provides a collection of default configuration values, in cases the property editor is not configured. The object is a key/value collection and must match the prevalue fields keys. | The `editor` object then has the following properties: @@ -160,7 +159,7 @@ The [DataEditor](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Pro | Name | Type | Required | Description | |----------------| ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | | `Alias` | string | Yes | Gets the unique alias of the editor. | -| `EditorType` | [EditorType](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.PropertyEditors.EditorType.html) | Yes | Gets the type of the editor. Possible values are `EditorType.PropertyValue`, `EditorType.MacroParameter` or `EditorType.Nothing`. | +| `EditorType` | [EditorType](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.PropertyEditors.EditorType.html) | Yes | Gets the type of the editor. Possible values are `EditorType.PropertyValue` or `EditorType.Nothing`. | | `Name` | string | Yes | Gets the friendly name of the editor. | | `View` | string | Yes | Gets the view to use to render the editor. | | `ValueType` | string | No | Gets or sets the type of the edited value. | diff --git a/14/umbraco-cms/extending-cms/property-editors/package-manifest.md b/14/umbraco-cms/extending-cms/property-editors/package-manifest.md index 1b6b461df48..d7cbe37f1b3 100644 --- a/14/umbraco-cms/extending-cms/property-editors/package-manifest.md +++ b/14/umbraco-cms/extending-cms/property-editors/package-manifest.md @@ -1,6 +1,6 @@ # Package Manifest -The `package.manifest` JSON file format is used to describe one or more custom Umbraco property editors, grid editors or parameter editors. This page outlines the file format and properties found in the JSON. +The `package.manifest` JSON file format is used to describe one or more custom Umbraco property editors or grid editors. This page outlines the file format and properties found in the JSON. ## Sample Manifest @@ -118,7 +118,7 @@ Example package.manifest ## Property Editors -`propertyEditors` returns an array of property editor definitions, each object specifies an editor to make available to data types as an editor component. These editors are primarily property editors for content, media and members. They can also be made available as a macro parameter editor. +`propertyEditors` returns an array of property editor definitions, each object specifies an editor to make available to data types as an editor component. These editors are primarily property editors for content, media and members. The basic values on any editor are `alias`, `name` and `editor`. These three **must** be set. Furthermore the editor value is an object with additional configuration options, it must contain a view value. @@ -138,12 +138,11 @@ The basic values on any editor are `alias`, `name` and `editor`. These three **m * `alias` The alias of the editor, this must be unique, its recommended to prefix with your own "namespace". * `name` The name visible to the user in the UI, should also be unique. * `editor` Object containing editor configuration (see below). -* `isParameterEditor` enables the property editor as a macro parameter editor can be `true`/`false`. * `prevalues` Configuration of editor prevalues (see below). * `defaultConfig` Default configuration values (see below). * `icon` A CSS class for the icon to be used in the 'Select Editor' dialog: e.g. `icon-autofill`. * `group` The group to place this editor in within the 'Select Editor' dialog. Use a new group name or alternatively use an existing one such as `Pickers`. -* `defaultConfig` Provides a collection of default configuration values, in case the property editor is not configured or is using a parameter editor, which doesn't allow configuration. The object is a key/value collection and must match the `prevalues` fields keys. +* `defaultConfig` Provides a collection of default configuration values, in case the property editor is not configured which doesn't allow configuration. The object is a key/value collection and must match the `prevalues` fields keys. ### Editor @@ -220,7 +219,7 @@ If you specify a name like `boolean` then Umbraco will look at `/wwwroot/umbraco ### Default Config -The defaultConfig object provides a collection of default configuration values in case the property editor is not configured or is using a parameter editor, which doesn't allow configuration. The object is a key/value collection and must match the prevalue field keys. +The defaultConfig object provides a collection of default configuration values in case the property editor is not configured which doesn't allow configuration. The object is a key/value collection and must match the prevalue field keys. ```json "defaultConfig": { @@ -249,12 +248,6 @@ Similar to how the `propertyEditors` array defines one or more property editors, However the default grid editors are already configured. -## Parameter Editors - -`parameterEditors` returns an array of editor objects, each object specifies an editor to make available to macro parameters as an editor component. These editors work solely as parameter editors and will not show up on the property editors list. - -The parameter editors array follows the same format as the property editors described above, however it cannot contain prevalues since there are no configuration options for macro parameter editors. - ## JavaScript `javascript` returns a string\[] of JavaScript files to load on application start diff --git a/14/umbraco-cms/fundamentals/backoffice/sections.md b/14/umbraco-cms/fundamentals/backoffice/sections.md index 38459b7b6f1..fbbd45b3567 100644 --- a/14/umbraco-cms/fundamentals/backoffice/sections.md +++ b/14/umbraco-cms/fundamentals/backoffice/sections.md @@ -40,14 +40,12 @@ The Settings tree consists of: * Media Types * Member Types * Data Types -* Macros * Relation Types * Log Viewer * Languages * Content Templates * Templates (`.cshtml` files) * Partial views (`.cshtml` files) -* Partial View Macro Files (`.cshtml` files) * Stylesheets (`.css` files) * Scripts (`.js` files) diff --git a/14/umbraco-cms/fundamentals/backoffice/settings-dashboards.md b/14/umbraco-cms/fundamentals/backoffice/settings-dashboards.md index e068c3ef10b..97ff63bfc13 100644 --- a/14/umbraco-cms/fundamentals/backoffice/settings-dashboards.md +++ b/14/umbraco-cms/fundamentals/backoffice/settings-dashboards.md @@ -85,7 +85,7 @@ The Telemetry Data dashboard is a consent screen that is used for collecting sys **Detailed** is the default option where the data sent contains: * Anonymized site ID, Umbraco version, and packages installed. -* Number of: Root nodes, Content nodes, Macros, Media, Document Types, Templates, Languages, Domains, User Group, Users, Members, and Property Editors in use. +* Number of: Root nodes, Content nodes, Media, Document Types, Templates, Languages, Domains, User Group, Users, Members, and Property Editors in use. * System information: Webserver, server OS, server framework, server OS language, and database provider. * Configuration settings: Modelsbuilder mode, if custom Umbraco path exists, ASP environment, and if you are in debug mode. diff --git a/14/umbraco-cms/fundamentals/code/creating-forms.md b/14/umbraco-cms/fundamentals/code/creating-forms.md index 8f1f5f6d6d9..c7eb94a7728 100644 --- a/14/umbraco-cms/fundamentals/code/creating-forms.md +++ b/14/umbraco-cms/fundamentals/code/creating-forms.md @@ -119,36 +119,6 @@ You can add the form to a template by rendering the partial view: } ``` -## Adding the form through the backoffice - -To add the form to your site we'll make a macro. This also makes it possible to let editors add the form to a page using the rich text editor. - -### Creating a macro - -Go to the Settings section and right-click the __Partial Views Macro Files__ node. Choose "Create" and select __New partial view macro__. Name the macro *Contact Form*. - -In the partial view, we're going to render our contact form using the view model we created earlier. - -```csharp -@inherits Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage; - -@using MyFirstForm.Models; - -@{ - Html.RenderPartial("~/Views/Partials/ContactForm.cshtml", new ContactFormViewModel()); -} -``` - -#### Adding the macro - -The last thing to do before we can add the form to a page is to __allow the Macro in a rich text editor__. Expand the __Macros__ node and select the __Contact Form__ Macro. Check the boxes under __Editor Settings__. - -{% hint style="info" %} -If you don't see your new macro listed, right click __Macros__ and select __Reload__. -{% endhint %} - -Now you can add the form to a page that has a rich text editor. - ### More information - [Surface Controllers](../../reference/routing/surface-controllers/README.md) diff --git a/14/umbraco-cms/fundamentals/code/source-control.md b/14/umbraco-cms/fundamentals/code/source-control.md index 226242e7641..9eabdd6618a 100644 --- a/14/umbraco-cms/fundamentals/code/source-control.md +++ b/14/umbraco-cms/fundamentals/code/source-control.md @@ -118,12 +118,6 @@ You would need to manually merge these files before considering a deployment. Umbraco Cloud is a good solution in these scenarios, as changes via the backoffice are tracked in a Git repository automatically. -#### Macros - -To source/version control changes to Macro implementation code, track the files in the following location: - -* **Partial View Macros** - stored in `/Views/MacroPartials` as .cshtml files - #### Controllers/Classes/Custom Code Any supporting custom code for your application should be in version control, eg any of the following files diff --git a/14/umbraco-cms/fundamentals/code/umbraco-services.md b/14/umbraco-cms/fundamentals/code/umbraco-services.md index 02db8c2ccb8..7dc2fdb3d82 100644 --- a/14/umbraco-cms/fundamentals/code/umbraco-services.md +++ b/14/umbraco-cms/fundamentals/code/umbraco-services.md @@ -229,7 +229,6 @@ There is full API coverage of all Umbraco core entities: * [EntityService](../../reference/management/services/entityservice.md) * [FileService](../../reference/management/services/fileservice.md) * [LocalizationService](../../reference/management/services/localizationservice/) -* [MacroService](../../reference/management/services/macroservice.md) * [MediaService](../../reference/management/services/mediaservice.md) * [MemberService](../../reference/management/services/memberservice.md) * [MemberTypeService](../../reference/management/services/membertypeservice.md) diff --git a/14/umbraco-cms/fundamentals/data/dictionary-items.md b/14/umbraco-cms/fundamentals/data/dictionary-items.md index c273f271334..8500398403d 100644 --- a/14/umbraco-cms/fundamentals/data/dictionary-items.md +++ b/14/umbraco-cms/fundamentals/data/dictionary-items.md @@ -4,7 +4,7 @@ description: Creating Dictionary Items in Umbraco # Dictionary Items -Depending on how your site is set up, not all content is edited through the **Content** section. There might be some text in your templates or macros that needs translation. Using Dictionary Items, you can store a value for each language. Dictionary Items have a unique key that is used to fetch the value of the Dictionary Item. +Depending on how your site is set up, not all content is edited through the **Content** section. There might be some text in your templates that needs translation. Using Dictionary Items, you can store a value for each language. Dictionary Items have a unique key that is used to fetch the value of the Dictionary Item. Dictionary Items can be managed from the **Translation** section. Let's take a look at an example. In this example, we will translate "Welcome to Umbraco" from within the template and add it to the dictionary: diff --git a/14/umbraco-cms/fundamentals/design/README.md b/14/umbraco-cms/fundamentals/design/README.md index 3bc6ba0fb58..9855ffb0c57 100644 --- a/14/umbraco-cms/fundamentals/design/README.md +++ b/14/umbraco-cms/fundamentals/design/README.md @@ -16,10 +16,6 @@ Querying and rendering media items. Working with partial views in Umbraco's templates. -## [Partial View Macro Files](partial-view-macro-files.md) - -Working with partial views macro files. - ## [Stylesheets and JavaScript](stylesheets-javascript.md) Working with CSS and JavaScript in Umbraco's templates. diff --git a/14/umbraco-cms/fundamentals/design/partial-view-macro-files.md b/14/umbraco-cms/fundamentals/design/partial-view-macro-files.md deleted file mode 100644 index 0403bcd2849..00000000000 --- a/14/umbraco-cms/fundamentals/design/partial-view-macro-files.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -description: Information on working with partial view macro files in Umbraco ---- - -# Partial View Macro Files - -A Macro is a reusable piece of functionality with some configuration options in the Backoffice. A Partial View Macro File (`.cshtml` file) is a specific file configuration that is associated with the Macro. A Partial View Macro File generates a Macro that can be inserted and rendered in the Grid and Rich Text Editor data types. Additionally, you can define parameter values and enable caching in Macros in the Backoffice. Partial View Macro Files are the recommended macro type to use in Umbraco. - -## Partial View Macro Files in the Backoffice - -You can create and edit Partial View Macro Files in the **Partial View Macro Files** folder from the **Settings** section of the Backoffice. - -![Creating a new partial view macro file](../../../../10/umbraco-cms/fundamentals/design/images/creating-partial-view-macro-files.png) - -In the **Create** menu, there are four options available: - -* New partial view macro -* New partial view macro (without macro) -* New partial view macro from snippet -* Folder (for keeping the partial view macro files organized) - -## Creating a Partial View Macro File - -To create a Partial View Macro File, go to the **Settings** section in the Umbraco backoffice and right-click the **Partial View Macro Files** folder. Choose **Create**. Select **New partial view macro** and enter a Partial View Macro Filename. Enter the macro logic and click the **Save** button. You will now see the Partial View Macro File in the **Partial View Macro Files** folder. You also see the macro in the **Macros** folder in the Backoffice. - -![Created partial view](../../../../10/umbraco-cms/fundamentals/design/images/created-partial-view-macro-file.png) - -By default, the Partial View Macro File is saved in the `Views/MacroPartials` folder. - -## Creating a Partial View Macro File (without macro) - -To create a Partial View Macro File without a macro, go to the **Settings** section in the Umbraco backoffice. Click right on the **Partial View Macro Files** folder. Choose **Create**. Select **New partial view macro (without macro)** and enter a Partial View Macro Filename. Enter the macro logic and click the **Save** button. You will now see _only_ the Partial View Macro File in the **Partial View Macro Files** folder in the Backoffice. - -![Created partial view](../../../../10/umbraco-cms/fundamentals/design/images/created-partial-view-macro-file-without-macro.png) - -By default, the Partial View Macro File is saved in the `Views/MacroPartials` folder. - -## Creating a Partial View Macro File from Snippet - -To create a Partial View Macro File from the snippet, go to the **Settings** section in the Umbraco backoffice. Click right on the **Partial Views Macro Files** folder. Choose **Create**. Select **New empty partial view macro from snippet**. Select the snippet you want to create a partial view for and enter a Partial View Macro Filename. The code snippet you selected is displayed in the backoffice editor. Click the **Save** button. You will now see the Partial View Macro File in the **Partial View Macro Files** folder. You also see the macro in the **Macros** folder in the Backoffice. - -![Created partial view from snippet](../../../../10/umbraco-cms/fundamentals/design/images/created-partial-view-macro-file-from-snippet.png) - -By default, the partial view is saved in the `Views/MacroPartials` folder. Umbraco provides the following partial view macro snippets: - -* Empty - Creates an empty partial view file. -* Breadcrumb - Creates a breadcrumb of parents using the `Ancestors()` method to generate links in an unordered HTML list. It displays the name of the current page without a link. -* Edit Profile - Creates a Member profile model that can be edited. -* Gallery - Displays a gallery of images from the Media section. It works with either a 'Single Media Picker' or a 'Multiple Media Picker' macro parameters. -* List Ancestors From Current Page - Displays a list of links to the parents of the current page using the `Ancestors()` method to generate links in an unordered HTML list. It displays the name of the current page without a link. -* List Child Pages From Changeable Source - Lists all the child pages under a specific page in the Content tree. -* List Child Pages From Current Page - Displays a list of links to the children of the current page using the `Children()` method to generate links in an unordered HTML list. -* List Child Pages Ordered By Date - Displays a list of links to the children of the current page using the `Children()` method to generate links in an unordered HTML list. The pages are sorted by the creation date in a descending order using the `OrderByDescending()` method. -* List Child Pages Ordered By Name - Displays a list of links to the children of the current page using the `Children()` method to generate links in an unordered HTML list. The pages are sorted by the page name using the `OrderBy()` method. -* List Child Pages With DocType - Displays only the children of a certain Document Type. -* List Descendants From Current Page - Displays a list of links for every page below the current page in an unordered HTML list. -* List Images From Media Picker - Displays a series of images from a media folder. -* Login - Displays a login form. -* Login Status - Displays the user name if the user is logged in. -* Multinode Tree-picker - Lists the items from a Multinode tree picker using the picker's default settings. -* Navigation - Displays a list of links of the pages under the top-most page in the Content tree. It also highlights the currently active page/section in the navigation menu. -* Register Member - Displays a Member registration form. It will only display the properties marked as **Member can edit** on the **Info** tab of the Member Type. -* Site Map - Displays a list of links of all the visible pages of the site using the `Traverse()` method to select and display the markup and links as nested unordered HTML lists. -* InsertUmbracoFormWithTheme - If a theme is provided as a macro parameter, Umbraco Forms will use the custom theme files. -* RenderUmbracoFormScripts - Renders your Umbraco Forms scripts. In many cases, you might prefer rendering your scripts at the bottom of the page as this generally improves site performance. - -## Creating a Folder - -To create a folder, go to the **Settings** section in the Umbraco backoffice and right-click the **Partial Views Macro Files** folder. Choose **Create** and select **Folder**. Enter a folder name and click the **Create** button. - -![Created folder](../../../../10/umbraco-cms/fundamentals/design/images/folder.png) - -## Rendering a Partial View Macro File - -To render the created Partial View Macro File in any template, use the `RenderMacroAsync` method: - -```csharp -@await Umbraco.RenderMacroAsync("InsertImages") -``` - -### Related Articles - -* [Macros](../../reference/templating/macros/) -* [Managing Macros](../../reference/templating/macros/managing-macros.md) -* [Partial View Macros](../../reference/templating/macros/partial-view-macros.md) -* [Macro Parameter Editors](../../extending/macro-parameter-editors.md) diff --git a/14/umbraco-cms/fundamentals/setup/server-setup/permissions.md b/14/umbraco-cms/fundamentals/setup/server-setup/permissions.md index 0256ac4739c..2bcaafb8efd 100644 --- a/14/umbraco-cms/fundamentals/setup/server-setup/permissions.md +++ b/14/umbraco-cms/fundamentals/setup/server-setup/permissions.md @@ -23,7 +23,7 @@ The permissions documentation should allow you to run a plain Umbraco install su |`/appSettings*.json` |Modify / Full control |Only needed for setting database and a global identifier during installation. So can be set to read-only afterwards for enhanced security.| |`/App_Plugins` |Modify / Full control |Should always have modify rights as the folder and its files are used by packages. Not part of your project by default.| |`/umbraco` |Modify / Full control |Should always have modify rights as the folder and its files are used for cache and storage.| -|`/Views` |Modify / Full control |Should always have modify rights as the folder and its files are used for Templates, Partial views, and Macro files.| +|`/Views` |Modify / Full control |Should always have modify rights as the folder and its files are used for Templates and Partial views| |`/wwwroot/css` |Modify / Full control |Should always have modify rights as the folder and its files are used for css files.| |`/wwwroot/media` |Modify / Full control |Should always have modify rights as the folder and its files are used for Media files uploaded via the Umbraco CMS backoffice.| |`/wwwroot/scripts` |Modify / Full control |Should always have modify rights as the folder and its files are used for script files.| diff --git a/14/umbraco-cms/fundamentals/setup/server-setup/runtime-modes.md b/14/umbraco-cms/fundamentals/setup/server-setup/runtime-modes.md index afba35a7fb7..60d31b1ef78 100644 --- a/14/umbraco-cms/fundamentals/setup/server-setup/runtime-modes.md +++ b/14/umbraco-cms/fundamentals/setup/server-setup/runtime-modes.md @@ -28,7 +28,7 @@ This mode disables in-memory ModelsBuilder generation and validates the followin * `Umbraco:CMS:ModelsBuilder:ModelsMode` is **not set** to `InMemoryAuto`. -If you want to use the generated models, use `SourceCodeAuto` or `SourceCodeManual`, which requires manually recompiling the project after the models have changed (e.g. after updating Document Types, Media Types, Member Types, or Data Types). Razor views (`cshtml` files) will still be automatically compiled at runtime, allowing you to quickly iterate on the rendered output from templates, (macro) partial views, and view components. +If you want to use the generated models, use `SourceCodeAuto` or `SourceCodeManual`. These require manually recompiling the project after the models have changed (for example after updating Document Types, Media Types, Member Types, or Data Types). Razor views (`cshtml` files) will still be automatically compiled at runtime. They allow you to quickly iterate on the rendered output from templates, partial views, and view components. The recommended approach to enable `Development` mode is to update the `appsettings.json` file with the following settings: diff --git a/14/umbraco-cms/fundamentals/setup/upgrading/version-specific/README.md b/14/umbraco-cms/fundamentals/setup/upgrading/version-specific/README.md index 5f730601b7b..fe11566fb59 100644 --- a/14/umbraco-cms/fundamentals/setup/upgrading/version-specific/README.md +++ b/14/umbraco-cms/fundamentals/setup/upgrading/version-specific/README.md @@ -34,7 +34,7 @@ Below you can find the list of breaking changes introduced in Umbraco 14 CMS. * [Migration from Newtonsoft.Json to the System.Text.Json which removes Nested Content and Grid value converter and so on](https://github.com/umbraco/Umbraco-CMS/pull/15728) * Nested Content and Grid Layout have been removed * [Legacy media picker has been removed](https://github.com/umbraco/Umbraco-CMS/pull/15835) -* [Macros have been removed](https://github.com/umbraco/Announcements/issues/14). Use partial views and/or blocks in the RTE. +* [Macros and Partial View Macros have been removed](https://github.com/umbraco/Announcements/issues/14). Use partial views and/or blocks in the Rich Text Editor. * XPath has been removed. An alternative is using the Dynamic Roots in the Multinode Treepicker. * [package-manifest is now umbraco.package.json](../../../../extending-backoffice/package-manifest.md) * [Smidge has been removed from default installation](https://github.com/umbraco/Umbraco-CMS/pull/15788). Can be manually installed if needed. diff --git a/14/umbraco-cms/implementation/composing.md b/14/umbraco-cms/implementation/composing.md index c87c633882c..ba00f758b54 100644 --- a/14/umbraco-cms/implementation/composing.md +++ b/14/umbraco-cms/implementation/composing.md @@ -167,7 +167,6 @@ Below is a list of collections with their corresponding 'collection type' and ho | MediaUrlProviders | Ordered | Explicit Registration | | NPocoMappers | Set | Explicit Registration | | PackageMigrationPlans | Lazy | Type scanned for `PackageMigrationPlan` | -| PartialViewMacroSnippets | Lazy | Explicit Registration. Reads .cshtml files from `Umbraco.Cms.Core.EmbeddedResources.Snippets` assembly & any files found on disk at `/umbraco/PartialViewMacros/Templates` | | PartialViewSnippets | Lazy | Explicit Registration. Reads .cshtml files from `Umbraco.Cms.Core.EmbeddedResources.Snippets` assembly | | PropertyValueConverters | Ordered | Type scanned for `IPropertyValueConverter` | | RuntimeModeValidators | Set | Explicit Registration | diff --git a/14/umbraco-cms/reference/configuration/contentsettings.md b/14/umbraco-cms/reference/configuration/contentsettings.md index f2b6af06d95..0a0ce5d38c1 100644 --- a/14/umbraco-cms/reference/configuration/contentsettings.md +++ b/14/umbraco-cms/reference/configuration/contentsettings.md @@ -41,7 +41,6 @@ The following snippet will give an overview of the keys and values in the conten }, "LoginBackgroundImage": "assets/img/login.jpg", "LoginLogoImage": "assets/img/application/umbraco_logo_white.svg", - "MacroErrors": "Inline", "Notifications": { "DisableHtmlEmail": false, "Email": null @@ -138,17 +137,6 @@ You can specify your own background image for the login screen here. The image w You can specify your own image for the small logo in the top left corner of the login screen. This path is relative to the `wwwroot/umbraco` path. The default location is: `wwwroot/umbraco/assets/img/application/umbraco_logo_white.svg`. -### Macro errors - -This setting allows you to specify how errors in macros should be handled. - -Options: - -* Inline - Default Umbraco behavior, show an inline error within the macro but allow the page to continue rendering. -* Silent - Silently suppress the error and do not display the offending macro. -* Throw - Throw an exception. -* Content - Silently suppress the error, and display custom content reported in the error event args. - ### Preview badge This allows you to customize the preview badge being shown when you're previewing a node. diff --git a/14/umbraco-cms/reference/configuration/healthchecks.md b/14/umbraco-cms/reference/configuration/healthchecks.md index 8c60d712be9..d41e9c5991c 100644 --- a/14/umbraco-cms/reference/configuration/healthchecks.md +++ b/14/umbraco-cms/reference/configuration/healthchecks.md @@ -37,7 +37,7 @@ An example of a HealthChecks settings can look something like this: } ``` -This config will disable the macro errors check, and enable notifications to run the checks and notify via email if a check fails. The checks will run the first time five minutes after the site is booted, and then once every day. +This config will enable notifications to run the checks and notify via email if a check fails. The checks will run the first time five minutes after the site is booted, and then once every day. The email notification method is built in, if you want to read more about creating you own notification methods, or see a list of the ID of every built in health check, then see [Extending health checks](../../extending/health-check/) diff --git a/14/umbraco-cms/reference/content-delivery-api/README.md b/14/umbraco-cms/reference/content-delivery-api/README.md index aa9aad047e3..a55df35341b 100644 --- a/14/umbraco-cms/reference/content-delivery-api/README.md +++ b/14/umbraco-cms/reference/content-delivery-api/README.md @@ -661,8 +661,6 @@ There are certain limitations associated with some of the built-in property edit #### Rich Text Editor -The Delivery API is not going to support the rendering of Macros within the Rich Text Editor. Therefore, any Macros included in the content will not be executed or output when retrieving content through the API. - When outputting the Rich Text Editor content as HTML (_the default format_), be aware that internal links may be insufficient in a multi-site setup. There is a possibility that this limitation may be addressed in future updates. However, consider the alternative approach to rendering the Rich Text Editor content as JSON. #### Member Picker diff --git a/14/umbraco-cms/reference/management/services/macroservice.md b/14/umbraco-cms/reference/management/services/macroservice.md deleted file mode 100644 index 5eb5ea6331d..00000000000 --- a/14/umbraco-cms/reference/management/services/macroservice.md +++ /dev/null @@ -1,46 +0,0 @@ -# MacroService - -Defines the MacroService, which is an access to operations involving `IMacro`. - -[Browse the API documentation for IMacroService interface](https://apidocs.umbraco.com/v13/csharp/api/Umbraco.Cms.Core.Services.IMacroService.html). - -* **Namespace:** `Umbraco.Cms.Core.Services` -* **Assembly:** `Umbraco.Core.dll` - - All samples in this document will require references to the following dll: - -* Umbraco.Core.dll - -```csharp -using Umbraco.Cms.Core.Services; -``` - -For Razor views: - -```csharp -@using Umbraco.Cms.Core.Services -``` - -## Getting the service - -### Dependency Injection - -If you wish to use the macro service in a class, you need to specify the `IMacroService` interface in your constructor: - -```csharp -public class MyClass -{ - private IMacroService _macroService; - - public MyClass(IMacroService macroService) - { - _macroService = macroService; - } -} -``` - -In Razor views, you can access the macro service through the `@inject` directive: - -```csharp -@inject IMacroService MacroService -``` diff --git a/14/umbraco-cms/reference/querying/umbraco-context.md b/14/umbraco-cms/reference/querying/umbraco-context.md index 1e8b110ce17..324615bfaeb 100644 --- a/14/umbraco-cms/reference/querying/umbraco-context.md +++ b/14/umbraco-cms/reference/querying/umbraco-context.md @@ -12,13 +12,13 @@ You can use UmbracoContext to access the content and media cache. Other useful p ## How to reference UmbracoContext -If you are using Views or Partial View Macros you can reference the UmbracoContext with the syntax: `@UmbracoContext` +If you are using Views you can reference the UmbracoContext with the syntax: `@UmbracoContext` If you need an `UmbracoContext` in your own controllers, you need to inject an `IUmbracoContextAccessor`. The following is an example of how to get access to the `UmbracoContext` in a controller: -``` +``` csharp using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/14/umbraco-cms/reference/querying/umbracohelper.md b/14/umbraco-cms/reference/querying/umbracohelper.md index d890d34d573..c9dd36bce2d 100644 --- a/14/umbraco-cms/reference/querying/umbracohelper.md +++ b/14/umbraco-cms/reference/querying/umbracohelper.md @@ -10,7 +10,7 @@ UmbracoHelper also has a variety of helper methods that are useful when working ## How to reference UmbracoHelper -If you are using Views or Partial View Macros you can reference UmbracoHelper with the syntax: `@Umbraco` +If you are using Views you can reference UmbracoHelper with the syntax: `@Umbraco` If you need an `UmbracoHelper` in your own controllers, you need to inject an instance. @@ -141,21 +141,3 @@ Alternatively, you can also specify an `altText` which will be returned if the d ```html

@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. - -![Insert Image Carousel](../../../../../10/umbraco-cms/reference/templating/macros/images/image-carousel-macro-v8.PNG) - -Define the parameters - -![Define the parameters](../../../../../10/umbraco-cms/reference/templating/macros/images/macro-parameter-editor-v8.png) - -Using in a Rich Text Area - -A Rich Text Editor should be enabled with macros in the toolbar to allow inserting macros. - -![Enable macro toolbar in Rich Text Area](../../../../../10/umbraco-cms/reference/templating/macros/images/rte-macro.png) - -Rich Text Area with macro toolbar option - -![Macro toolbar option in Rich Text Area](../../../../../10/umbraco-cms/reference/templating/macros/images/rte-macro-toolbar.png) - -Insert the macro into a Rich Text Area - -![Insert the macro into a Rich Text Area](../../../../../10/umbraco-cms/reference/templating/macros/images/pick-images-for-macro-example-v8.png) - -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 {{ "name", "Ned"}, { "age", 27}}) -``` - -#### Meaning of all the symbols - -**Request Collection** - -To retrieve a value from the request collection such as a query string parameter we specify it by prefixing with an "@" symbol. - -To get a query string parameter with the key "productId" we would specify our parameter like this **\[@productId]** - -**Document Type Property** - -Document type properties are specified by a leading "#" and then the alias of the document property. - -To pass a property with the alias "bodyText" we would specify **\[#bodyText]** in the parameter value. - -**Recursive Document Type Property** - -Recursive Document type properties are specified by a leading "$" and then the alias of the document property. - -Umbraco resolves recursive parameters by looking at the current page for a value and then traversing up the content tree until a value with that alias is found. - -**Session Collection** - -Retrieve values from the session collection or cookies by prefixing with a "%" symbol. - -To retrieve a value with the key "memberId" from the session collection we would specify our Macro parameter value as **\[%memberId]** - -### Caching Macro Output - -For long running macros that return the same results, caching boosts site performance, you can specify caching levels for the Macro in the backoffice. - -Options are: - -* Cache by Period - set the number of seconds to cache the output of the Macro for -* Cache by Page - Whether to create a different cached instance of the macro for each page (think breadcrumb - you wouldn't want the same breadcrumb on every page) -* Cache Personalized - whether to create a difference cached instance of the macro for each site visitor (if your Macro says 'Hi Niels' using the currently logged in Members name, you wouldn't want this cached to be the same for every visitor to the site, unless they were all called Niels) diff --git a/14/umbraco-cms/reference/templating/macros/images/Image-Carousel-Macro.png b/14/umbraco-cms/reference/templating/macros/images/Image-Carousel-Macro.png deleted file mode 100644 index 22fdc266a8c..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/Image-Carousel-Macro.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/create-macro-from-type.png b/14/umbraco-cms/reference/templating/macros/images/create-macro-from-type.png deleted file mode 100644 index 7062db09db0..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/create-macro-from-type.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/create-macro-tree-8.png b/14/umbraco-cms/reference/templating/macros/images/create-macro-tree-8.png deleted file mode 100644 index 29c91f246cb..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/create-macro-tree-8.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/create-macro-tree.png b/14/umbraco-cms/reference/templating/macros/images/create-macro-tree.png deleted file mode 100644 index b4d7d6ecfb2..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/create-macro-tree.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/image-carousel-macro-parameter.png b/14/umbraco-cms/reference/templating/macros/images/image-carousel-macro-parameter.png deleted file mode 100644 index 3840b2385e8..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/image-carousel-macro-parameter.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/image-carousel-macro-v8.PNG b/14/umbraco-cms/reference/templating/macros/images/image-carousel-macro-v8.PNG deleted file mode 100644 index a19a3992bfc..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/image-carousel-macro-v8.PNG and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/inline-macro-in-richtext.png b/14/umbraco-cms/reference/templating/macros/images/inline-macro-in-richtext.png deleted file mode 100644 index d3ebe870d6c..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/inline-macro-in-richtext.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/macro-editor-8.png b/14/umbraco-cms/reference/templating/macros/images/macro-editor-8.png deleted file mode 100644 index a123b1af06d..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/macro-editor-8.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/macro-editor.png b/14/umbraco-cms/reference/templating/macros/images/macro-editor.png deleted file mode 100644 index 3cdd9b4b300..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/macro-editor.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/macro-parameter-editor-v8.png b/14/umbraco-cms/reference/templating/macros/images/macro-parameter-editor-v8.png deleted file mode 100644 index 0d88bc74b34..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/macro-parameter-editor-v8.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/macro-parameter-editor.png b/14/umbraco-cms/reference/templating/macros/images/macro-parameter-editor.png deleted file mode 100644 index 35c4e8f6df5..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/macro-parameter-editor.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/macro-parameters-v8.png b/14/umbraco-cms/reference/templating/macros/images/macro-parameters-v8.png deleted file mode 100644 index 64c97a7f1a9..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/macro-parameters-v8.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/partial-view-macro-files-8.png b/14/umbraco-cms/reference/templating/macros/images/partial-view-macro-files-8.png deleted file mode 100644 index 5b0753f1c8f..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/partial-view-macro-files-8.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/pick-images-for-macro-example-v8.png b/14/umbraco-cms/reference/templating/macros/images/pick-images-for-macro-example-v8.png deleted file mode 100644 index 12bbff1cd2b..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/pick-images-for-macro-example-v8.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/pick-images-for-macro-example.png b/14/umbraco-cms/reference/templating/macros/images/pick-images-for-macro-example.png deleted file mode 100644 index 29c3d429311..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/pick-images-for-macro-example.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/rte-macro-toolbar.png b/14/umbraco-cms/reference/templating/macros/images/rte-macro-toolbar.png deleted file mode 100644 index 905dcb6def2..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/rte-macro-toolbar.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/images/rte-macro.png b/14/umbraco-cms/reference/templating/macros/images/rte-macro.png deleted file mode 100644 index 7f2b2518a5e..00000000000 Binary files a/14/umbraco-cms/reference/templating/macros/images/rte-macro.png and /dev/null differ diff --git a/14/umbraco-cms/reference/templating/macros/managing-macros.md b/14/umbraco-cms/reference/templating/macros/managing-macros.md deleted file mode 100644 index 55b57ef6b3d..00000000000 --- a/14/umbraco-cms/reference/templating/macros/managing-macros.md +++ /dev/null @@ -1,130 +0,0 @@ -# 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: - -![Create macro](../../../../../10/umbraco-cms/reference/templating/macros/images/create-macro-tree-8.png) - -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**. - -![Partial View Macro files dialog](../../../../../10/umbraco-cms/reference/templating/macros/images/partial-view-macro-files-8.png) - -The dialog provides the following options: - -* New partial view macro: Will give you an empty macro with an associated empty partial view file -* New partial view macro (without macro): Will give you a partial view, without an associated macro -* New partial view macro from snippet...: Will give you the option to choose between a pre-defined set, including a macro and a partial view with a code snippet -* Folder...: Will give you the option to create a folder below "Partial View Macro Files" - -## Macro Editor - -The macro editor view comes with a set of configuration options. - -![Macro editor](../../../../../10/umbraco-cms/reference/templating/macros/images/macro-editor-8.png) - -### 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 - -> Use in rich text editor and the grid - -If selected will allow an editor to insert this macro in to a Rich Text Editor and/or into a Grid editor. - -## Caching options - -> Cache period - -Defines how many seconds the macro output will be cached for once it is rendered - -> Cache by page - -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. - -> Cache personalized - -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: - -![Macro editor](../../../../../10/umbraco-cms/reference/templating/macros/images/macro-parameters-v8.png) - -Here you can add/modify/remove macro parameters. - -### Default macro parameter types - -This list defines the different types of macro parameters: - -* Checkbox(`Umbraco.TrueFalse`) - A true/false value -* Content Type picker (`contentType`) - Choose a type from existing Document Types -* Decimal (`Umbraco.Decimal`) - accepts only numbers -* Email address (`Umbraco.EmailAddress`) - validates to valid email addresses -* Multiple Content Picker (`Umbraco.MultiNodeTreePicker`) - pick 1 or more nodes from the Content tree -* Multiple Content Type Picker (`contentTypeMultiple`) - pick 1 or more types from existing Document Types -* Multiple Media Picker (`Umbraco.MultipleMediaPicker`) - pick 1 or more media items -* Multiple Property Type Picker (`propertyTypePickerMultiple`) - pick 1 or more from existing property types -* Multiple Tab Picker (`tabPickerMultiple`) - pick 1 or more from existing tabs -* Numeric (`Umbraco.Integer`) - accepts only numbers -* Property Type Picker (`propertyTypePicker`) - choose property from existing property types -* Tab picker (`tabPicker`) - select 1 from list of existing tabs -* Textarea (`Umbraco.TextArea`) - multiple lines of text -* Textbox (`Umbraco.TextBox`) - single line of text -* Media picker (`Umbraco.MediaPicker`) - select a single media item -* Content Picker (`Umbraco.ContentPicker`) - select a single content node from the Content tree -* Form Picker (`UmbracoForms.FormsPicker`) - choose from existing Umbraco Forms -* Forms Theme Picker (`UmbracoForms.ThemePicker`) - choose from existing Forms Themes - -## Enable Inline Macro - -In some case you want to have the macro in the middle of a sentence. - -![Inline macros used multiple places inside a single Rich Text Editor](images/inline-macro-in-richtext.png) - -To enable editors to add the macro inline, follow these steps: - -1. Add a macro parameter called: **enableInlineMacro**. -2. Choose Checkbox (`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: - -```csharp - [DataEditor( - alias: "enableInlineMacro", - type: EditorType.MacroParameter, - name: "Enable Inline Macro", - view: "boolean", - Group = "Macro Config", - Icon = "icon-list")] - public class EnableInlineMacro : DataEditor - { - public EnableInlineMacro(IDataValueEditorFactory dataValueEditorFactory) - : base(dataValueEditorFactory) - { - DefaultConfiguration.Add("default", "1"); - } - } -``` - -{% 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 %} diff --git a/14/umbraco-cms/reference/templating/macros/partial-view-macros.md b/14/umbraco-cms/reference/templating/macros/partial-view-macros.md deleted file mode 100644 index 87695dde58c..00000000000 --- a/14/umbraco-cms/reference/templating/macros/partial-view-macros.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -description: "Partial View Macros reference" ---- - - -# Partial View Macros - -Partial View Macros are the recommended macro type to use in Umbraco. They work in both MVC and Webforms and use the unified query syntax that is available via the `UmbracoHelper`. - -## View/Model Type - -All Partial View Macro views inherit from `Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage` and the header of each Partial View Macro file will contain: - -```csharp -@inherits Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage -``` - -The model type for a Partial View Macro is `Umbraco.Cms.Core.Models.PartialViewMacroModel`. This contains all of the properties you need to render out content alongside some additional -properties about the macro itself: - -- MacroName -- MacroAlias -- MacroId -- MacroParameters - -## File Information - -By default, Partial View Macros are stored in this folder: - -> ~/Views/MacroPartials - -However, if you are bundling up Partial View Macros as part of a package, they can also exist in this folder: - -> ~/App_Plugins/[YourPackageName]/Views/MacroPartials - -Since Partial View Macros are a normal MVC partial view, their file extension is **cshtml**. All Partial View Macro views inherit from the following view class: - -```csharp -Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage -``` - -Therefore, all files will contain the header (which is done automatically for you if creating Partial View Macros via the Umbraco backoffice): - -```csharp -@inherits Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage -``` - -## Accessing Content - -The syntax in Partial View Macros is similar to the **[MVC View](../mvc/views.md)** syntax. In fact, they are driven by the exact same engine as MVC Views. - -You can use @CurrentPage, @Model.Content, @Umbraco, ... - -## Accessing Macro Parameters - -You can access the macro's parameters using the: - -- `MacroParameters` property on the model which is of type `IDictionary`: - - ```csharp - var myParam = Model.MacroParameters["aliasOfTheMacroParameter"]; - ``` - -- Typed GetParameterValue method in `Umbraco.Cms.Core.Models` namespace: - - ```csharp - @using Umbraco.Cms.Core.Models; - var myParam = Model.GetParameterValue("aliasOfTheMacroParameter"); - ``` - -- Typed GetParameterValue method with the default value fallback: - - ```csharp - @using Umbraco.Cms.Core.Models; - var myParam = Model.GetParameterValue("aliasOfTheMacroParameter", "default value if parameter value has not been set"); - ``` diff --git a/14/umbraco-cms/reference/templating/mvc/README.md b/14/umbraco-cms/reference/templating/mvc/README.md index cccb2bb60c5..134a98ed7ad 100644 --- a/14/umbraco-cms/reference/templating/mvc/README.md +++ b/14/umbraco-cms/reference/templating/mvc/README.md @@ -12,7 +12,7 @@ Working with MVC Views and Razor syntax in Umbraco ## [Partial Views](partial-views.md) -Documentation covering how to use Partial Views. This is not documentation about using "[Partial View Macros](../macros/partial-view-macros.md)", this documentation relates to using native MVC partial views within Umbraco. +Documentation covering how to use Partial Views. This documentation relates to using native MVC partial views within Umbraco. ## [ViewComponents](viewcomponents.md) diff --git a/14/umbraco-cms/reference/templating/mvc/examples.md b/14/umbraco-cms/reference/templating/mvc/examples.md index 387956b2210..e4b4151d910 100644 --- a/14/umbraco-cms/reference/templating/mvc/examples.md +++ b/14/umbraco-cms/reference/templating/mvc/examples.md @@ -15,24 +15,6 @@ _Lots of examples of using various techniques to render data in a view_ @Model.Value("bodyContent") ``` -## Rendering a macro - -```csharp -@Umbraco.RenderMacro("myMacroAlias") -``` - -## Rendering a macro with parameters using an anonymous object - -```csharp -@Umbraco.RenderMacro("myMacroAlias", new { name = "Ned", age = 28 }) -``` - -## Rendering a macro with parameters using a dictionary - -```csharp -@Umbraco.RenderMacro("myMacroAlias", new Dictionary {{ "name", "Ned"}, { "age", 27}}) -``` - ## Rendering some member data ```csharp diff --git a/14/umbraco-cms/reference/templating/mvc/partial-views.md b/14/umbraco-cms/reference/templating/mvc/partial-views.md index f4cf43bb8fc..2816c7e8cda 100644 --- a/14/umbraco-cms/reference/templating/mvc/partial-views.md +++ b/14/umbraco-cms/reference/templating/mvc/partial-views.md @@ -3,7 +3,7 @@ This section will show you how to use MVC Partial Views in Umbraco. {% hint style="warning" %} -Please note, this is documentation relating to the use of native MVC partial views, not '[Partial View Macros](../macros/partial-view-macros.md)' +Please note, this is documentation relating to the use of native MVC partial views {% endhint %} ## Overview @@ -87,7 +87,7 @@ Another case you might have is that you want your Partial View to be strongly ty ## Caching -You don't normally need to cache the output of Partial views, like you don't normally need to cache the output of User Controls, but there are times when this is necessary. Like macro caching, we provide caching output of partial views. This is done by using an HtmlHelper extension method: +You don't normally need to cache the output of Partial views, like you don't normally need to cache the output of User Controls. However, there are times when this is necessary and so we provide caching output of partial views. This is done by using an HtmlHelper extension method: ```csharp @await Html.CachedPartialAsync("ChildItem", page, TimeSpan.FromHours(1)) diff --git a/14/umbraco-cms/reference/templating/mvc/views.md b/14/umbraco-cms/reference/templating/mvc/views.md index 4f3474b7b95..289385f13c9 100644 --- a/14/umbraco-cms/reference/templating/mvc/views.md +++ b/14/umbraco-cms/reference/templating/mvc/views.md @@ -7,7 +7,7 @@ _Working with MVC Views and Razor syntax in Umbraco_ All Umbraco views inherit from `Umbraco.Cms.Web.Common.Views.UmbracoViewPage` along with the using statement `@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;`. This exposes many properties that are available in razor. The properties on the Document Type can be accessed in a number of ways: * @Model (of type `Umbraco.Web.Mvc.ContentModel`) -> the model for the view which contains the standard list of IPublishedContent properties but also gives you access to the typed current page (of type whatever type you have added in the angled brackets). -* @Umbraco (of type `UmbracoHelper`) -> contains many helpful methods, from rendering macros and fields to retrieving content based on an Id and tons of other helpful methods. [See UmbracoHelper Documentation](../../querying/umbracohelper.md) +* @Umbraco (of type `UmbracoHelper`) -> contains many helpful methods, from rendering fields to retrieving content based on an Id and tons of other helpful methods. [See UmbracoHelper Documentation](../../querying/umbracohelper.md) * @Html (of type `HtmlHelper`) -> the same HtmlHelper you know and love from Microsoft but we've added a bunch of handy extension methods like @Html.BeginUmbracoForm * @UmbracoContext (of type `Umbraco.Cms.Web.Common.UmbracoContext`) @@ -55,28 +55,6 @@ If you want to convert a type and it's possible, you can do that by typing a var In this example, we are looping through a list of items with the custom made type TeamMember assigned. This means we are able to access the strongly typed properties on the TeamMember item. -## Rendering Macros - -Rendering a macro is done using UmbracoHelper. There are 3 overloads, we'll start with the most basic: - -This renders a macro with the specified alias without any parameters: - -```csharp -@await Umbraco.RenderMacroAsync("myMacroAlias") -``` - -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 {{ "name", "Ned"}, { "age", 27}}) -``` - [UmbracoHelper Documentation](../../querying/umbracohelper.md) ## Accessing Member data diff --git a/14/umbraco-cms/tutorials/creating-a-custom-dashboard/README.md b/14/umbraco-cms/tutorials/creating-a-custom-dashboard/README.md index 9c6696bd0bb..9b5f6a9e4e8 100644 --- a/14/umbraco-cms/tutorials/creating-a-custom-dashboard/README.md +++ b/14/umbraco-cms/tutorials/creating-a-custom-dashboard/README.md @@ -456,7 +456,7 @@ angular.module("umbraco").controller("CustomWelcomeDashboardController", functio ``` {% endcode %} -We need to loop through the log items from the `logResource`. Since this includes everything, we need to filter out activities we're not interested in eg, Macro Saves, or DocType Saves. Generally, we need the entry in the log to have a `nodeId`, a `logType` of 'save' and an entity type of Media or Content. +We need to loop through the log items from the `logResource`. Since this includes everything, we need to filter out activities we're not interested in such as DocType Saves. Generally, we need the entry in the log to have a `nodeId`, a `logType` of 'save' and an entity type of Media or Content. The `entityResource` has a `getById` method that accepts the `ID` of the item and the entity `type` to retrieve useful information about the entity. For example, its Name and Icon. diff --git a/14/umbraco-cms/tutorials/creating-and-distributing-a-package.md b/14/umbraco-cms/tutorials/creating-and-distributing-a-package.md index 581b5bd3b0e..07517a240df 100644 --- a/14/umbraco-cms/tutorials/creating-and-distributing-a-package.md +++ b/14/umbraco-cms/tutorials/creating-and-distributing-a-package.md @@ -155,7 +155,6 @@ The `package.xml` file is the one containing all package metadata, and the file - diff --git a/14/umbraco-cms/tutorials/editors-manual/working-with-content/README.md b/14/umbraco-cms/tutorials/editors-manual/working-with-content/README.md index 309c9d0f366..faf61113846 100644 --- a/14/umbraco-cms/tutorials/editors-manual/working-with-content/README.md +++ b/14/umbraco-cms/tutorials/editors-manual/working-with-content/README.md @@ -11,7 +11,6 @@ If you want to use advanced functionality, you can insert images, create tables, * [View Source Code](./#view-source-code) * [Links](./#links) * [Working with Images](./#working-with-images) -* [Macros](./#macros) * [Tables](./#tables) Contact your system administrator for details regarding your editor. @@ -261,43 +260,6 @@ To delete an image from the page: 1. Select the image in your editor. 2. Press **Delete** on your keyboard. The image is removed from the page, but is not deleted from the Umbraco media library. -### Macros - -In Umbraco, macros are small building blocks of functionality that can be used in an editor. Each macro encompasses a piece of functionality and provides an interface to be able to modify the macro as per your requirements. A macro can be anything from a contact form to an embeddable media player. The advantage of macros is that it gives editors the ability to add complex elements to the page in a less complex manner. - -The macros available to you differ from system to system. Contact your system administrator to find out which macros are available to you and what they do. - -#### Adding a Macro to the Page - -1. Place the cursor in the editor where you want to insert your macro. -2. Click the **Insert Macro** button. The **Select Macro** tree opens on the right-side of the editor. -3. Select a macro to insert or enter the macro name in the **Search** bar. - - ![Macro Picker](../../../../../10/umbraco-cms/tutorials/editors-manual/working-with-content/images/Select-a-macro.png) -4. Configure the macro as required. -5. Click **Submit** to insert the macro. The macro is displayed in the editor with a dotted border. - - ![Macro Editor](../../../../../10/umbraco-cms/tutorials/editors-manual/working-with-content/images/Select-a-macro-v9.png) - -{% hint style="info" %} -If there are no macros, you can [Create Macros](../../../reference/templating/macros/managing-macros.md#creating-macros). The above image is an example of macros available when a Starter Kit package is installed. -{% endhint %} - -#### Editing macros - -You can edit the macro values after it has been added to the rich text editor: - -1. Highlight the macro in the rich text editor. -2. Click the **Insert Macro** button. The **Select Macro** tree opens on the right-side of the editor. -3. Here, you can edit the configuration as per your requirements. - -#### Removing macros - -To remove a macro: - -1. Highlight the macro in the rich text editor. -2. Press the **Delete** or **Backspace** button on your keyboard. - ### Tables Tables are used to format information in a grid based structure. When you insert a table, you select how many rows and columns the table should comprise of, as well as fill in a number of additional optional formatting properties. These values can be altered later, so it is not important to know exactly what your table will look like when you create it. diff --git a/14/umbraco-cms/tutorials/editors-manual/working-with-content/rich-text-editor.md b/14/umbraco-cms/tutorials/editors-manual/working-with-content/rich-text-editor.md deleted file mode 100644 index 023fa95e02b..00000000000 --- a/14/umbraco-cms/tutorials/editors-manual/working-with-content/rich-text-editor.md +++ /dev/null @@ -1,285 +0,0 @@ -# Rich Text Editor - -The Umbraco Rich Text Editor (RTE) is a field where you, as an editor, can be creative. You select how much you want to do yourself. You can work on text content, format the text, or leave it the way it is. If you want to do more, you can insert images, create tables, or create links to other pages/documents. - -The functionality varies depending on how the editor is set up. Here, we describe the default editor with all the options enabled. Contact your system administrator for details regarding your editor. - -## Editor Buttons - -Below are the default editor buttons available. Your system administrator can determine which buttons are displayed in different templates. You could therefore have access to more or fewer buttons than those shown here. - -![RTE Toolbar](images/editorBar-v11.png) - -## Paragraph Break/Line Break - -The editor is like any other word-processing program. You write the text and the text wraps around when the line reaches the end. When you press `ENTER` in the editor, you get a paragraph break, which means there is space between the paragraphs. If you do not want a space, you have to make a line break instead. You do this by pressing `SHIFT+ENTER`. - -## Shortcut Keys - -To make your work easier, there are shortcut keys for certain editor functions. Shortcut keys let you use the keyboard to carry out certain commands. - -| Shortcut | Action | -| -------- | ---------- | -| Ctrl + A | Select all | -| Ctrl + B | Bold | -| Ctrl + C | Copy | -| Ctrl + I | Italic | -| Ctrl + U | Underline | -| Ctrl + V | Paste | -| Ctrl + X | Cut | -| Ctrl + Y | Redo | -| Ctrl + Z | Undo | - -We have listed only a few keyboard shortcuts. For a detailed list of available keyboard shortcuts, see the [official TinyMCE Documentation](https://www.tiny.cloud/docs/tinymce/latest/keyboard-shortcuts/). - -## View Source Code - -![View Source Code](images/view-source-code-v11.png) - -If you are proficient in the use of HTML, you can switch to HTML mode and create your page by writing HTML code. You can also check the code and make minor adjustments to get the page exactly as you want it. Certain elements such as scripts will not be allowed and will be filtered out of the code and pasted into the RTE. - -## Text Formatting - -You do not normally need to spend much time formatting text because Umbraco takes care of a lot of the formatting for you. When the default formatting is not enough, however, there are a couple of options for controlling the formatting of text: - -### Formats - -![Formats Button](images/Formats-Button-v11.png) - -You can apply formatting via the **Formats** drop-down list. The Formats drop-down list provides predefined styles that can be applied to text while maintaining a consistent look and feel throughout the site. - -These styles incorporate advanced formatting functionality which can be applied to provide a different look for certain elements such as links, headings, and sub-headings. For example, you can use a format style to change a link into a call-to-action button. - -While the styles available on your site may differ, you can apply styles: - -1. Select the text you want to apply the style to. -2. Select the style to apply from the **Format** drop-down list. - -For more information on how to create RTE Styles, see the [Rich Text Editor Styles](https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/rte-styles) article. - -### Formatting Buttons - -![Formatting Buttons](images/Formatting-Buttons-v11.png) - -The most basic and probably the most familiar way to control formatting are via the formatting buttons. These work the same as those found in most word-processing applications such as Microsoft Word. With these you can apply basic formatting such as Bold, Italic, Underline, altering text alignment, bulleted and numbered lists, and altering text indentations. - -Regardless of the formatting being applied, you can apply a format using the formatting buttons: - -1. Select the text you want to apply the formatting to. -2. Click the appropriate format button to apply the formatting you wish to add. - -### Copying Content from Other Programs - -When you pre-write content to copy it later into a RTE you may encounter style issues on your website. When pasting content, the original text styles will be preserved. This can lead to different font faces, sizes, and colors from what is expected when the website is viewed. It is advisable to paste the content into a markdown editor such as notepad, then copy, and paste it into your RTE. - -### Remove Formatting - -![Remove Format Button](images/Remove-Format-v11.png) - -If you have formatted a paragraph or selection using the formatting buttons, you can remove a formatting rule: - -1. Select the text you want to remove the formatting from. -2. Click the relevant formatting button to remove the formatting rule. -3. Alternatively, you can use the **Remove Format** button from the toolbar. - -{% hint style="info" %} -If you do not have the **Remove Format** button, contact your system administrator. -{% endhint %} - -## Links - -![Link Button](images/Link-Button-v11.png) - -The **Insert/Edit Link** button is used to create links to internal pages, external pages, media files, email links, and anchors. The process for inserting a hyperlink differs depending on the type of hyperlink you wish to create: - -### Link to a Page on another Website - -1. Select the text that will form the hyperlink. -2. Click the **Insert/Edit Link** button to open the link properties slide-out menu. -3. Enter the URL of the web page you wish to link to in the **Link** field. -4. Enter the text that will be displayed as the link title in the **Link Title** field. - - This is important information for everyone reading the website with different accessibility aids. -5. Select the **Target** field to open the link in a new window or tab. -6. Click **Submit**. - -![Link to a Page on another Website](images/Link-to-an-external-Page-v11.png) - -### Link to a Page in Umbraco - -1. Select the text that will form the hyperlink. -2. Click the **Insert/Edit Link** button to open the link properties slide-out menu. -3. Select a page from the **Link to page** field. - - This will populate the **Link** and **Link Title** fields automatically. -4. Select the **Target** field to open the link in a new window or tab. -5. Click **Submit**. - -![Link to a Page in Umbraco](images/Link-to-a-Page-v11.png) - -### Link to a Media File in Umbraco - -1. Select the text that will form the hyperlink. -2. Click the **Insert/Edit Link** button to open the link properties slide-out menu. -3. Select the **Link to Media** button to select the media item. -4. Click **Select**. - - This will populate the **Link** and **Link Title** fields automatically with the media item information. - - By default, the **Link** field contains the media file name and cannot be edited. -5. Select the **Target** field to open the link in a new window or tab. -6. Click **Submit**. - -![Link to a Media File in Umbraco](images/Link-to-Media-File-v11.png) - -### Link to an Email Address in Umbraco - -1. Select the text that will form the hyperlink. -2. Click the **Insert/Edit Link** button to open the link properties slide-out menu. -3. Enter the text `mailto:` followed by the email address you wish to link to in the **Link** field. For example, `mailto:contact@umbraco.com`. -4. Enter the text that will be displayed as the link title in the **Link Title** field. -5. Select the **Target** field to open the link in a new window or tab. -6. Click **Submit**. - -![Link to an Email Address in Umbraco](images/Link-to-Email-Address-v11.png) - -### Link to an Anchor on the Same Page - -An anchor allows you to create internal page links that enable users to navigate within a page. There are two parts to setting up an anchor; the anchor itself and the link to the anchor. - -### Creating an Anchor - -1. Click the editor cursor where you wish to create the anchor. -2. Click the **Anchor Button** which will launch the Anchor creation dialog. -3. Enter your anchor name in the **ID** field. - - You should avoid special characters and spaces. -4. Click **Save**. - - You will see a small anchor icon where you previously had the editor cursor. - -![Creating an Anchor](images/Creating-an-anchor-v11.png) - -To delete the anchor: - -1. Select the anchor icon. -2. Press your **Delete** key. - -![Deleting an Anchor](images/Delete-an-anchor-v11.png) - -### Linking to an anchor - -1. Select the text to which you wish to add the anchor link to. -2. Click the **Insert link** button to open the link properties slide-out menu. -3. Add a hash symbol (#) followed by the name of your anchor in the **Anchor/querystring** field. -4. Enter the text that will be displayed as the link title in the **Link Title** field. -5. Click **Submit**. - -![Linking to an anchor](images/Linking-to-Anchor-v11.png) - -### Create a Link from an Image - -You can make images into clickable links in Umbraco: - -1. Insert an image into the RTE. - - For more information, see the [Working with Images](#working-with-images) section. -2. Select the image that will form the hyperlink. -3. Enter the URL of the web page you wish to link to in the **Link** field. -4. Enter the text that will be displayed as the link title in the **Link Title** field. -5. Select the **Target** field to open the link in a new window or tab. -6. Click **Submit**. - -![Create a Link from an Image](images/Link-from-Image-v11.png) - -### Removing a Link - -![Remove link Button](images/Remove-link-v11.png) - -To remove a link: - -1. Select the link in the RTE. - - For text links, click the cursor anywhere within the link text. For an image, click the image itself. -2. Click the **Remove Link** button which will remove the hyperlink. -3. Alternatively, you can click the **Insert/Edit Link** button and remove the link from the **Link** field. - -## Working with Images - -To display images on a page they must be uploaded to your Umbraco Media library. Many organizations set up a media library containing images that editors can use on their pages. Others allow their editor's free use of their images. The procedure for uploading an image varies slightly depending on which method your organization uses. Check with your system administrator about what applies to your organization. - -### Inserting an Image from the Media Library - -1. Place the cursor in the RTE where you want to insert your image. -2. Click the **Media Picker** button from the toolbar. -3. Select the folder in which the image is. -4. Click the thumbnail of your chosen image to open the image properties menu. -5. Enter a name/description for the image in the **Caption (optional)** field. - - It is important to add descriptive titles to images as these are used to assist visually impaired users. -6. Click **Select**. - -![Inserting an Image from the Media Library](images/Inserting-Image-from-the-Media-Library-v11.png) - -### Inserting an Image from your Computer - -You can upload images directly from the RTE on the page you are editing. These images will be stored in the Umbraco Media library. Therefore care should be taken to ensure that the image is placed in the correct location within the library. If you click the plus icon underneath the search bar in the media picker slide-out menu you can create folders in the media library. - -1. Place the cursor in the RTE where you want to insert your image. -2. Click the **Media Picker** button from the toolbar. -3. Click the **Upload** button which is located in the top right-hand corner of the menu. -4. Select the chosen image from the pop-up window. -5. Enter a name/description for the image in the **Caption (optional)** field. -6. Click **Select**. - -![Inserting an Image from your Computer](images/Inserting-an-Image-from-Computer-v11.png) - -### Deleting an Image from the Page - -To delete an image from the page: - -1. Select the image. -2. Press the **Delete** button on your keyboard. - - The image disappears from the page but is not deleted from the Umbraco Media library. - -## Macros - -In Umbraco, macros are small building blocks of functionality that can be dropped into an editor. Each macro encompasses a piece of functionality and provides an interface to modify the macro to your requirements. A macro can be anything from a contact form to an embedded media player. The advantage of macros is that it gives editors the ability to add complex elements to a page. - -The macros available differ on each system. Kindly check with your system administrator to find out which macros are available to you and what they do. The process for adding and updating a macro is as follows: - -### Adding a Macro to the Page - -1. Place the cursor in the RTE where you want to insert your macro. -2. Click the **Insert Macro** button from the toolbar. -3. Select a macro to insert from the macros list. -4. Click **Submit**. - - The macro is displayed in the editor with a dotted border. - -![Adding a Macro to the Page](images/Select-Macro-v11.png) - -### Editing macros - -You can edit values after a macro has been added to the RTE: - -1. Select the macro in the RTE. -2. Click the **Insert Macro** button from the toolbar. - - This will open the configuration menu where you can edit any values previously added. - -### Removing macros - -To remove a macro: - -1. Select the macro in the RTE. -2. Press the **Delete** or **Backspace** button on your keyboard. - -## Tables - -Tables are used to format information in a grid-based structure. When you insert a table, you select how many rows and columns the table should comprise of. Additionally, you can fill in some optional formatting properties. These values can be changed later, so it is not important to know exactly what your table will look like when you create it. - -![Inserting a Table](images/Insert-a-table-v11.png) - -### Editing an Existing Table - -To edit the table after creating it, click on the table. A pop-up appears with different table properties and options. Alternatively, you can click on the **Table** button in the RTE toolbar. - -![Editing an Existing Table](images/Editing-an-existing-table-v11.png) - -Clicking on **Table Properties** gives you different options for modifying the table’s appearance. However, the developer of the website may have already created table styles for you so you may not need to adjust these settings. There are other options available for modifying cells, rows, and columns such as width, height, alignment, border, and so on. - -![Table Properties](images/table-properties-v11.png) - -## Configuring a RTE - -The RTE in Umbraco can be configured in many different ways. For more information, see the [Rich Text Editor Configuration](https://docs.umbraco.com/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/rich-text-editor/configuration) article. diff --git a/14/umbraco-cms/tutorials/members-registration-and-login.md b/14/umbraco-cms/tutorials/members-registration-and-login.md index 5a19d5fa75c..bcd4a4cc2cd 100644 --- a/14/umbraco-cms/tutorials/members-registration-and-login.md +++ b/14/umbraco-cms/tutorials/members-registration-and-login.md @@ -4,6 +4,10 @@ description: >- login functionality for the frontend of your application. --- +{% hint style="warning" %} +This guide is awaiting to be updated as it uses Macros and Partial View Macros which have been removed from v14. +{% endhint %} + # Member Registration and Login Using tools available on a fresh install of Umbraco CMS, you can create a frontend-based registration and login functions and restrict access to specific areas of your site based on this system. @@ -38,7 +42,7 @@ Since the Register and Login were created as macro partials, you will have corre ## Include the Macros and Partials in Content and Templates -Halfway there! Next, navigate to your Content section. Since we created Register and Login partials as macro partials, we can paste them into a Richtext Editor. Create a new page that is using this editor. Then give it a name (for example Login/Signup). Do the same in any Rich Text Editor or Grid Editors you have on the page, insert a Macro. +Halfway there! Next, navigate to your Content section. Since we created Register and Login partials as macro partials, we can paste them into a Richtext Editor. Create a new page that is using this editor and give it a name such as Login/Signup. ![RTE macro](images/v8-06-RTE-Macro.png) diff --git a/14/umbraco-cms/tutorials/starter-kit/lessons/2-add-a-blog-post-publication-date/part-3.md b/14/umbraco-cms/tutorials/starter-kit/lessons/2-add-a-blog-post-publication-date/part-3.md index 1cffe34a761..9e7c2b106db 100644 --- a/14/umbraco-cms/tutorials/starter-kit/lessons/2-add-a-blog-post-publication-date/part-3.md +++ b/14/umbraco-cms/tutorials/starter-kit/lessons/2-add-a-blog-post-publication-date/part-3.md @@ -6,10 +6,9 @@ Finally, in Part Three we shall change the blog listing. ## Steps - Part Three -1. In the **Settings** section, expand **Partial View Macro Files**. +1. In the **Settings** section, expand **Partial View Files**. * Select *LatestBlogPosts.cshtml*. - * **Macros** are beyond the scope of this lesson, but you don't need to understand them right now. 2. Scroll down to find the `blogpost-date` element and change it to use a nicely formatted Publication Date, i.e.: