Skip to content

Commit 384646b

Browse files
Obsolete MediaItem and add Content property
1 parent dd8b451 commit 384646b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/Umbraco.Core/Models/MediaWithCrops.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using Umbraco.Core.Models.PublishedContent;
23
using Umbraco.Core.PropertyEditors.ValueConverters;
34

@@ -15,7 +16,16 @@ public class MediaWithCrops : PublishedContentWrapped
1516
/// <value>
1617
/// The media item.
1718
/// </value>
18-
public IPublishedContent MediaItem => Unwrap();
19+
[Obsolete("This instance now implements IPublishedContent by wrapping the media item, use the extension methods directly on MediaWithCrops or use the Content property to get the media item instead.")]
20+
public IPublishedContent MediaItem => Content;
21+
22+
/// <summary>
23+
/// Gets the content/media item.
24+
/// </summary>
25+
/// <value>
26+
/// The content/media item.
27+
/// </value>
28+
public IPublishedContent Content => Unwrap();
1929

2030
/// <summary>
2131
/// Gets the local crops.
@@ -51,7 +61,7 @@ public class MediaWithCrops<T> : MediaWithCrops
5161
/// <value>
5262
/// The media item.
5363
/// </value>
54-
public new T MediaItem { get; }
64+
public new T Content { get; }
5565

5666
/// <summary>
5767
/// Initializes a new instance of the <see cref="MediaWithCrops{T}" /> class.
@@ -61,7 +71,7 @@ public class MediaWithCrops<T> : MediaWithCrops
6171
public MediaWithCrops(T content, ImageCropperValue localCrops)
6272
: base(content, localCrops)
6373
{
64-
MediaItem = content;
74+
Content = content;
6575
}
6676

6777
/// <summary>
@@ -71,6 +81,6 @@ public MediaWithCrops(T content, ImageCropperValue localCrops)
7181
/// <returns>
7282
/// The result of the conversion.
7383
/// </returns>
74-
public static implicit operator T(MediaWithCrops<T> mediaWithCrops) => mediaWithCrops.MediaItem;
84+
public static implicit operator T(MediaWithCrops<T> mediaWithCrops) => mediaWithCrops.Content;
7585
}
7686
}

0 commit comments

Comments
 (0)