Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

`Returns: IEnumerable<MediaWithCrops>` 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 one of the following:

- A collection (`IEnumerable<MediaWithCrops>`) if the **Pick multiple items** setting is enabled.
- A single `MediaWithCrops` item if the **Pick multiple items** setting is disabled.

## Data Type Definition Example

Expand Down Expand Up @@ -71,6 +74,23 @@ Global crops are configured on the Image Cropper property of the Image Media Typ
}
```

#### Multiple enabled without Modelsbuilder to retrieve IEnumerable<IPublishedContent> data

```csharp
@using Umbraco.Cms.Core.Models
@{
var listOfImages = Model.Value<IEnumerable<IPublishedContent>>("medias");
foreach (var image in listOfImages)
{
<img src="@image.Url()" alt="@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 enabled with Modelsbuilder

```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

`Returns: IEnumerable<MediaWithCrops>` 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 one of the following:

- A collection (`IEnumerable<MediaWithCrops>`) if the **Pick multiple items** setting is enabled.
- A single `MediaWithCrops` item if the **Pick multiple items** setting is disabled.

## Data Type Definition Example

Expand Down Expand Up @@ -73,6 +76,23 @@ Global crops are configured on the Image Cropper property of the Image Media Typ
}
```

#### Multiple enabled without Modelsbuilder to retrieve IEnumerable<IPublishedContent> data

```csharp
@using Umbraco.Cms.Core.Models
@{
var listOfImages = Model.Value<IEnumerable<IPublishedContent>>("medias");
foreach (var image in listOfImages)
{
<img src="@image.Url()" alt="@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 enabled with Modelsbuilder

```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

`Returns: IEnumerable<MediaWithCrops>` 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 one of the following:

- A collection (`IEnumerable<MediaWithCrops>`) if the **Pick multiple items** setting is enabled.
- A single `MediaWithCrops` item if the **Pick multiple items** setting is disabled.

## Data Type Definition Example

Expand Down Expand Up @@ -73,6 +76,23 @@ Global crops are configured on the Image Cropper property of the Image Media Typ
}
```

#### Multiple enabled without Modelsbuilder to retrieve IEnumerable<IPublishedContent> data

```csharp
@using Umbraco.Cms.Core.Models
@{
var listOfImages = Model.Value<IEnumerable<IPublishedContent>>("medias");
foreach (var image in listOfImages)
{
<img src="@image.Url()" alt="@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 enabled with Modelsbuilder

```csharp
Expand Down
Loading