-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
212 additions
and
31 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/Limbo.Umbraco.Migrations/Constants/UmbracoMediaTypes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Limbo.Umbraco.Migrations.Constants; | ||
|
||
public static class UmbracoMediaTypes { | ||
|
||
public const string Article = global::Umbraco.Cms.Core.Constants.Conventions.MediaTypes.ArticleAlias; | ||
|
||
public const string Video = global::Umbraco.Cms.Core.Constants.Conventions.MediaTypes.VideoAlias; | ||
|
||
public const string VectorGraphics = global::Umbraco.Cms.Core.Constants.Conventions.MediaTypes.VectorGraphicsAlias; | ||
|
||
public const string Pdf = Article; | ||
|
||
public const string Svg = VectorGraphics; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/Limbo.Umbraco.Migrations/Extensions/MigrationsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Limbo.Umbraco.Migrations.Constants; | ||
using Limbo.Umbraco.Migrations.Models.UrlPicker; | ||
using Limbo.Umbraco.MigrationsClient.Models.Content; | ||
using Limbo.Umbraco.MigrationsClient.Models.Umbraco; | ||
using Skybrud.Essentials.Exceptions; | ||
using Umbraco.Cms.Core.Models; | ||
using Umbraco.Extensions; | ||
|
||
using UmbracoGuidUdi = Umbraco.Cms.Core.GuidUdi; | ||
|
||
namespace Limbo.Umbraco.Migrations.Extensions; | ||
|
||
public static class MigrationsExtensions { | ||
|
||
public static UmbracoGuidUdi? ToUmbracoUdi(this GuidUdi? udi) { | ||
return udi is null ? null : new UmbracoGuidUdi(udi.EntityType, udi.Guid); | ||
} | ||
|
||
public static UrlPickerList AddContent(this UrlPickerList list, LegacyContent content, string? target = null, string? queryString = null) { | ||
list.Add(UrlPickerItem.CreateContentItem(content.Name, new UmbracoGuidUdi(UmbracoEntityTypes.Content, content.Key), content.Url, target, queryString)); | ||
return list; | ||
} | ||
|
||
public static UrlPickerList AddMedia(this UrlPickerList list, IMedia media, string? target = null, string? queryString = null) { | ||
string url = media.GetValue<string>("umbracoFile") ?? throw new BjernerSaysNoException(); | ||
list.Add(UrlPickerItem.CreateMediaItem(media.Name!, media.GetUdi(), url, target, queryString)); | ||
return list; | ||
} | ||
|
||
public static UrlPickerList? NullIfEmpty(this UrlPickerList? list) { | ||
return list is null || list.Count == 0 ? null : list; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
|
||
namespace Limbo.Umbraco.Migrations.Models; | ||
|
||
public class Warning { | ||
|
||
public string Message { get; } | ||
|
||
public Exception? Exception { get; } | ||
|
||
public Warning(string message) { | ||
Message = message; | ||
} | ||
|
||
public Warning(string message, Exception? exception) { | ||
Message = message; | ||
Exception = exception; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.