From a5962ff1c27491c03735a559a119eddd86acd46a Mon Sep 17 00:00:00 2001 From: Esha Noronha Date: Tue, 10 Dec 2024 13:43:18 +0100 Subject: [PATCH 1/3] Update article as per feedback --- .../media-picker-3.md | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/13/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md b/13/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md index 494fa66023a..b93edd75881 100644 --- a/13/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md +++ b/13/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md @@ -4,7 +4,10 @@ `Returns: IEnumerable` or `MediaWithCrops` -This property editors returns a single `MediaWithCrops` item if the "Pick multiple items" Data Type setting is disabled or a collection if it is enabled. +This property editors returns: + +- A collection (`IEnumerable`) if the **Pick multiple items** setting is enabled. +- A single `MediaWithCrops` item if the **Pick multiple items** setting is disabled. ## Data Type Definition Example @@ -83,6 +86,23 @@ Global crops are configured on the Image Cropper property of the Image Media Typ } ``` +### Multiple enabled without Modelsbuilder to retrieve IEnumerable data + +```csharp +@using Umbraco.Cms.Core.Models +@{ + var listOfImages = Model.Value>("medias"); + foreach (var image in listOfImages) + { + @image.Name + } +} +``` + +{% hint style="info" %} +While `MediaWithCrops` is the default return type, `IPublishedContent` may be used in backward-compatible implementations or when working directly with core APIs. +{% endhint %} + ### Multiple disabled without Modelsbuilder ```csharp From a15cebd1a386d270b76314b1f90d32e4fbcad4c0 Mon Sep 17 00:00:00 2001 From: Esha Noronha Date: Tue, 10 Dec 2024 14:53:11 +0100 Subject: [PATCH 2/3] Added to v14 and v15 --- .../media-picker-3.md | 22 ++++++++++++++++++- .../media-picker-3.md | 22 ++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md b/14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md index 8451e3e7c72..366d13a9c76 100644 --- a/14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md +++ b/14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md @@ -6,7 +6,10 @@ `Returns: IEnumerable` or `MediaWithCrops` -This property editors returns a single `MediaWithCrops` item if the "Pick multiple items" Data Type setting is disabled or a collection if it is enabled. +This property editors returns: + +- A collection (`IEnumerable`) if the **Pick multiple items** setting is enabled. +- A single `MediaWithCrops` item if the **Pick multiple items** setting is disabled. ## Data Type Definition Example @@ -85,6 +88,23 @@ Global crops are configured on the Image Cropper property of the Image Media Typ } ``` +### Multiple enabled without Modelsbuilder to retrieve IEnumerable data + +```csharp +@using Umbraco.Cms.Core.Models +@{ + var listOfImages = Model.Value>("medias"); + foreach (var image in listOfImages) + { + @image.Name + } +} +``` + +{% hint style="info" %} +While `MediaWithCrops` is the default return type, `IPublishedContent` may be used in backward-compatible implementations or when working directly with core APIs. +{% endhint %} + ### Multiple disabled without Modelsbuilder ```csharp diff --git a/15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md b/15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md index b9d34510878..4d4fce34255 100644 --- a/15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md +++ b/15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md @@ -6,7 +6,10 @@ `Returns: IEnumerable` or `MediaWithCrops` -This property editors returns a single `MediaWithCrops` item if the "Pick multiple items" Data Type setting is disabled or a collection if it is enabled. +This property editors returns: + +- A collection (`IEnumerable`) if the **Pick multiple items** setting is enabled. +- A single `MediaWithCrops` item if the **Pick multiple items** setting is disabled. ## Data Type Definition Example @@ -85,6 +88,23 @@ Global crops are configured on the Image Cropper property of the Image Media Typ } ``` +### Multiple enabled without Modelsbuilder to retrieve IEnumerable data + +```csharp +@using Umbraco.Cms.Core.Models +@{ + var listOfImages = Model.Value>("medias"); + foreach (var image in listOfImages) + { + @image.Name + } +} +``` + +{% hint style="info" %} +While `MediaWithCrops` is the default return type, `IPublishedContent` may be used in backward-compatible implementations or when working directly with core APIs. +{% endhint %} + ### Multiple disabled without Modelsbuilder ```csharp From 5d17d022978ff6e23d43272cc96375e0014e61af Mon Sep 17 00:00:00 2001 From: Esha Noronha Date: Thu, 12 Dec 2024 09:10:43 +0100 Subject: [PATCH 3/3] Incorporated suggestions --- .../media-picker-3.md | 28 +++++++++---------- .../media-picker-3.md | 28 +++++++++---------- .../media-picker-3.md | 28 +++++++++---------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/13/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md b/13/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md index b93edd75881..4a456299839 100644 --- a/13/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md +++ b/13/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md @@ -4,7 +4,7 @@ `Returns: IEnumerable` or `MediaWithCrops` -This property editors returns: +This property editors returns one of the following: - A collection (`IEnumerable`) if the **Pick multiple items** setting is enabled. - A single `MediaWithCrops` item if the **Pick multiple items** setting is disabled. @@ -74,19 +74,7 @@ Global crops are configured on the Image Cropper property of the Image Media Typ } ``` -### Multiple enabled with Modelsbuilder - -```csharp -@{ - var typedMultiMediaPicker = Model.Medias; - foreach (var entry in typedMultiMediaPicker) - { - - } -} -``` - -### Multiple enabled without Modelsbuilder to retrieve IEnumerable data +#### Multiple enabled without Modelsbuilder to retrieve IEnumerable data ```csharp @using Umbraco.Cms.Core.Models @@ -103,6 +91,18 @@ Global crops are configured on the Image Cropper property of the Image Media Typ While `MediaWithCrops` is the default return type, `IPublishedContent` may be used in backward-compatible implementations or when working directly with core APIs. {% endhint %} +### Multiple enabled with Modelsbuilder + +```csharp +@{ + var typedMultiMediaPicker = Model.Medias; + foreach (var entry in typedMultiMediaPicker) + { + + } +} +``` + ### Multiple disabled without Modelsbuilder ```csharp diff --git a/14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md b/14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md index 366d13a9c76..87ee7abe165 100644 --- a/14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md +++ b/14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md @@ -6,7 +6,7 @@ `Returns: IEnumerable` or `MediaWithCrops` -This property editors returns: +This property editors returns one of the following: - A collection (`IEnumerable`) if the **Pick multiple items** setting is enabled. - A single `MediaWithCrops` item if the **Pick multiple items** setting is disabled. @@ -76,19 +76,7 @@ Global crops are configured on the Image Cropper property of the Image Media Typ } ``` -### Multiple enabled with Modelsbuilder - -```csharp -@{ - var typedMultiMediaPicker = Model.Medias; - foreach (var entry in typedMultiMediaPicker) - { - - } -} -``` - -### Multiple enabled without Modelsbuilder to retrieve IEnumerable data +#### Multiple enabled without Modelsbuilder to retrieve IEnumerable data ```csharp @using Umbraco.Cms.Core.Models @@ -105,6 +93,18 @@ Global crops are configured on the Image Cropper property of the Image Media Typ While `MediaWithCrops` is the default return type, `IPublishedContent` may be used in backward-compatible implementations or when working directly with core APIs. {% endhint %} +### Multiple enabled with Modelsbuilder + +```csharp +@{ + var typedMultiMediaPicker = Model.Medias; + foreach (var entry in typedMultiMediaPicker) + { + + } +} +``` + ### Multiple disabled without Modelsbuilder ```csharp diff --git a/15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md b/15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md index 4d4fce34255..a9e95a9d469 100644 --- a/15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md +++ b/15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/media-picker-3.md @@ -6,7 +6,7 @@ `Returns: IEnumerable` or `MediaWithCrops` -This property editors returns: +This property editors returns one of the following: - A collection (`IEnumerable`) if the **Pick multiple items** setting is enabled. - A single `MediaWithCrops` item if the **Pick multiple items** setting is disabled. @@ -76,19 +76,7 @@ Global crops are configured on the Image Cropper property of the Image Media Typ } ``` -### Multiple enabled with Modelsbuilder - -```csharp -@{ - var typedMultiMediaPicker = Model.Medias; - foreach (var entry in typedMultiMediaPicker) - { - - } -} -``` - -### Multiple enabled without Modelsbuilder to retrieve IEnumerable data +#### Multiple enabled without Modelsbuilder to retrieve IEnumerable data ```csharp @using Umbraco.Cms.Core.Models @@ -105,6 +93,18 @@ Global crops are configured on the Image Cropper property of the Image Media Typ While `MediaWithCrops` is the default return type, `IPublishedContent` may be used in backward-compatible implementations or when working directly with core APIs. {% endhint %} +### Multiple enabled with Modelsbuilder + +```csharp +@{ + var typedMultiMediaPicker = Model.Medias; + foreach (var entry in typedMultiMediaPicker) + { + + } +} +``` + ### Multiple disabled without Modelsbuilder ```csharp