mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Adding FirstMediaUrl to MediaLibraryPickerField
This commit is contained in:
@@ -21,6 +21,19 @@ namespace Orchard.MediaLibrary.Fields {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the MediaUrl property of the first Media, or null if none
|
||||||
|
/// </summary>
|
||||||
|
public string FirstMediaUrl {
|
||||||
|
get {
|
||||||
|
if (!MediaParts.Any()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MediaParts.First().MediaUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private string EncodeIds(ICollection<int> ids) {
|
private string EncodeIds(ICollection<int> ids) {
|
||||||
if (ids == null || !ids.Any()) {
|
if (ids == null || !ids.Any()) {
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
Reference in New Issue
Block a user