Skip to content

Commit

Permalink
Updated the package to target Umbraco 13 😎
Browse files Browse the repository at this point in the history
  • Loading branch information
abjerner committed Feb 21, 2024
1 parent 0d27923 commit acdf912
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion debug.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
dotnet build src/Limbo.Umbraco.BlockList --configuration Debug /t:rebuild /t:pack -p:PackageOutputPath=c:\nuget\Umbraco10
dotnet build src/Limbo.Umbraco.BlockList --configuration Debug /t:rebuild /t:pack -p:PackageOutputPath=c:\nuget\Umbraco13
15 changes: 7 additions & 8 deletions src/Limbo.Umbraco.BlockList/Limbo.Umbraco.BlockList.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<LangVersion>10.0</LangVersion>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8</TargetFramework>
<StaticWebAssetBasePath>App_Plugins/$(AssemblyName)</StaticWebAssetBasePath>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>3.0.6</VersionPrefix>
<VersionPrefix>13.0.0-alpha000</VersionPrefix>
<VersionSuffix Condition="'$(Configuration)'=='Debug'">build$([System.DateTime]::UtcNow.ToString(`yyyyMMddHHmm`))</VersionSuffix>
<Company>Limbo</Company>
<Authors>Anders Bjerner</Authors>
<Copyright>Copyright © $([System.DateTime]::UtcNow.ToString(`yyyy`))</Copyright>
<Title>Limbo Block List</Title>
<Description>Extended block list editor for Umbraco 10+.</Description>
<Description>Extended block list editor for Umbraco 13.</Description>
</PropertyGroup>

<!-- Information for the NuGet package -->
<PropertyGroup>
<PackageId>Limbo.Umbraco.BlockList</PackageId>
<PackageTags>Skybrud, Limbo, Umbraco, Block, List, Umbraco-Marketplace</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://packages.limbo.works/limbo.umbraco.blocklist/v3/</PackageProjectUrl>
<PackageProjectUrl>https://packages.limbo.works/limbo.umbraco.blocklist/v13/</PackageProjectUrl>
<PackageIcon>Limbo.png</PackageIcon>
<PackageReadmeFile>NUGET.md</PackageReadmeFile>
<RepositoryType>git</RepositoryType>
Expand All @@ -34,9 +33,9 @@
<!-- Include NuGet dependencies -->
<ItemGroup>
<PackageReference Include="Skybrud.Essentials" Version="1.1.56" />
<PackageReference Include="Umbraco.Cms.Core" Version="[10.0.0,12.999)" />
<PackageReference Include="Umbraco.Cms.Web.Website" Version="[10.0.0,12.999)" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="[10.0.0,12.999)" />
<PackageReference Include="Umbraco.Cms.Core" Version="[13.0.0,13.999)" />
<PackageReference Include="Umbraco.Cms.Web.Website" Version="[13.0.0,13.999)" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="[13.0.0,13.999)" />
</ItemGroup>

<!-- Include package icon and README for the NuGet -->
Expand Down
12 changes: 1 addition & 11 deletions src/Limbo.Umbraco.BlockList/Manifests/BlockListManifestFilter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Reflection;
using Umbraco.Cms.Core.Manifest;

namespace Limbo.Umbraco.BlockList.Manifests;
Expand All @@ -13,6 +12,7 @@ public void Filter(List<PackageManifest> manifests) {
// Initialize a new manifest filter for this package
PackageManifest manifest = new() {
AllowPackageTelemetry = true,
PackageId = BlockListPackage.Alias,
PackageName = BlockListPackage.Name,
Version = BlockListPackage.InformationalVersion,
BundleOptions = BundleOptions.Independent,
Expand All @@ -24,16 +24,6 @@ public void Filter(List<PackageManifest> manifests) {
Stylesheets = new[] { $"/App_Plugins/{BlockListPackage.Alias}/Styles.css" }
};

// The "PackageId" property isn't available prior to Umbraco 12, and since the package is build against
// Umbraco 10, we need to use reflection for setting the property value for Umbraco 12+. Ideally this
// shouldn't fail, but we might at least add a try/catch to be sure
try {
PropertyInfo? property = manifest.GetType().GetProperty("PackageId");
property?.SetValue(manifest, BlockListPackage.Alias);
} catch {
// We don't really care about the exception
}

// Append the manifest
manifests.Add(manifest);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Limbo.Umbraco.BlockList.PropertyEditors;
/// Represents a block list property editor.
/// </summary>
[DataEditor(EditorAlias, EditorName, EditorView, ValueType = ValueTypes.Json, Group = "Limbo", Icon = EditorIcon)]
public class LimboBlockListPropertyEditor : BlockEditorPropertyEditor {
public class LimboBlockListPropertyEditor : BlockListPropertyEditorBase {

private readonly IIOHelper _ioHelper;
private readonly IEditorConfigurationParser _editorConfigurationParser;
Expand All @@ -29,7 +29,7 @@ public class LimboBlockListPropertyEditor : BlockEditorPropertyEditor {

#region Constructors

public LimboBlockListPropertyEditor(IDataValueEditorFactory dataValueEditorFactory, PropertyEditorCollection propertyEditors, IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser) : base(dataValueEditorFactory, propertyEditors) {
public LimboBlockListPropertyEditor(IDataValueEditorFactory dataValueEditorFactory, IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory, IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser) : base(dataValueEditorFactory, blockValuePropertyIndexValueFactory) {
_ioHelper = ioHelper;
_editorConfigurationParser = editorConfigurationParser;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using Limbo.Umbraco.BlockList.Converters;
using System;
using System.Diagnostics.CodeAnalysis;
using Umbraco.Cms.Core.DeliveryApi;
using Umbraco.Cms.Core.Logging;
using Umbraco.Cms.Core.Models.Blocks;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.PropertyEditors.ValueConverters;
using Umbraco.Cms.Core.Services;
using Umbraco.Extensions;

#pragma warning disable 1591
Expand All @@ -19,7 +21,10 @@ public class LimboBlockListPropertyValueConverter : BlockListPropertyValueConver
#region Constructors

public LimboBlockListPropertyValueConverter(IProfilingLogger proflog, BlockEditorConverter blockConverter,
BlockListTypeConverterCollection converterCollection) : base(proflog, blockConverter) {
BlockListTypeConverterCollection converterCollection,
IContentTypeService contentTypeService, IApiElementBuilder apiElementBuilder, BlockListPropertyValueConstructorCache constructorCache)
: base(proflog, blockConverter, contentTypeService, apiElementBuilder, constructorCache)
{
_converterCollection = converterCollection;
}

Expand Down

0 comments on commit acdf912

Please sign in to comment.