Skip to content

Commit 3efb53c

Browse files
Merge branch 'v13/dev' into v14/dev
2 parents 2424660 + e7b9f0d commit 3efb53c

15 files changed

+308
-6
lines changed

src/Umbraco.Deploy.Contrib/Extensions/ArtifactMigratorCollectionBuilderExtensions.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public static ArtifactMigratorCollectionBuilder AddLegacyMigrators(this Artifact
2626
.Append<ContentPicker2DataTypeArtifactMigrator>()
2727
.Append<ContentPickerAliasDataTypeArtifactMigrator>()
2828
.Append<DateDataTypeArtifactMigrator>()
29+
.Append<DropDownFlexibleDataTypeArtifactMigrator>() // Ensure this is appended before other dropdown migrators to avoid duplicate migration
2930
.Append<DropDownDataTypeArtifactMigrator>()
30-
.Append<DropDownFlexibleDataTypeArtifactMigrator>()
3131
.Append<DropdownlistMultiplePublishKeysDataTypeArtifactMigrator>()
3232
.Append<DropdownlistPublishingKeysDataTypeArtifactMigrator>()
3333
.Append<DropDownMultipleDataTypeArtifactMigrator>()
@@ -42,8 +42,6 @@ public static ArtifactMigratorCollectionBuilder AddLegacyMigrators(this Artifact
4242
.Append<TextboxDataTypeArtifactMigrator>()
4343
.Append<TextboxMultipleDataTypeArtifactMigrator>()
4444
.Append<TinyMCEv3DataTypeArtifactMigrator>()
45-
// Property values
46-
.Append<CheckBoxListPropertyValueArtifactMigrator>()
47-
.Append<DropDownListFlexiblePropertyValueArtifactMigrator>()
48-
.Append<RadioButtonListPropertyValueArtifactMigrator>();
45+
// Add prefixes to pre-value property editor aliases, triggering property type migrators
46+
.Append<PrevalueArtifactMigrator>();
4947
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Umbraco.Deploy.Contrib.Migrators.Legacy;
2+
using Umbraco.Deploy.Core.Migrators;
3+
4+
namespace Umbraco.Extensions;
5+
6+
public static class PropertyTypeMigratorCollectionBuilderExtensions
7+
{
8+
/// <summary>
9+
/// Adds the legacy property type migrators to allow importing from Umbraco 7.
10+
/// </summary>
11+
/// <returns>
12+
/// The property type migrator collection builder.
13+
/// </returns>
14+
public static PropertyTypeMigratorCollectionBuilder AddLegacyMigrators(this PropertyTypeMigratorCollectionBuilder propertyTypeMigratorCollectionBuilder)
15+
=> propertyTypeMigratorCollectionBuilder
16+
// Pre-values to a single value or JSON array
17+
.Append<CheckBoxListPropertyTypeMigrator>()
18+
.Append<DropDownPropertyTypeMigrator>()
19+
.Append<DropDownListFlexiblePropertyTypeMigrator>()
20+
.Append<DropdownlistMultiplePublishKeysPropertyTypeMigrator>()
21+
.Append<DropdownlistPublishingKeysPropertyTypeMigrator>()
22+
.Append<DropDownMultiplePropertyTypeMigrator>()
23+
.Append<RadioButtonListPropertyTypeMigrator>();
24+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Umbraco.Cms.Core;
2+
using Umbraco.Cms.Core.Serialization;
3+
4+
namespace Umbraco.Deploy.Contrib.Migrators.Legacy;
5+
6+
/// <summary>
7+
/// Migrates the property value using the <see cref="Constants.PropertyEditors.Aliases.CheckBoxList" /> editor containing prevalues (seperated by <see cref="PrevaluePropertyTypeMigratorBase.Delimiter" />) from Umbraco 7 to a JSON array.
8+
/// </summary>
9+
public sealed class CheckBoxListPropertyTypeMigrator : PrevaluePropertyTypeMigratorBase
10+
{
11+
/// <inheritdoc />
12+
protected override bool Multiple => true;
13+
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="CheckBoxListPropertyTypeMigrator" /> class.
16+
/// </summary>
17+
/// <param name="jsonSerializer">The JSON serializer.</param>
18+
public CheckBoxListPropertyTypeMigrator(IJsonSerializer jsonSerializer)
19+
: base(Constants.PropertyEditors.Aliases.CheckBoxList, jsonSerializer)
20+
{ }
21+
}

src/Umbraco.Deploy.Contrib/Migrators/Legacy/Content/CheckBoxListPropertyValueArtifactMigrator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using Umbraco.Cms.Core;
23
using Umbraco.Cms.Core.Serialization;
34
using Umbraco.Cms.Core.Services;
@@ -9,6 +10,7 @@ namespace Umbraco.Deploy.Contrib.Migrators.Legacy;
910
/// <summary>
1011
/// Migrates the <see cref="PropertyValueWithSegments" /> using the <see cref="Constants.PropertyEditors.Aliases.CheckBoxList" /> editor from the <see cref="ContentArtifactBase" /> containing prevalues (seperated by <see cref="PrevaluePropertyValueArtifactMigratorBase.Delimiter" />) from Umbraco 7 to a JSON array.
1112
/// </summary>
13+
[Obsolete("Migrating property values in an artifact migrator does not support nested/recursive properties. Use the PrevalueArtifactMigrator and CheckBoxListPropertyTypeMigrator instead. This class will be removed in a future version.")]
1214
public class CheckBoxListPropertyValueArtifactMigrator : PrevaluePropertyValueArtifactMigratorBase
1315
{
1416
/// <inheritdoc />
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Umbraco.Cms.Core;
2+
using Umbraco.Cms.Core.Serialization;
3+
4+
namespace Umbraco.Deploy.Contrib.Migrators.Legacy;
5+
6+
/// <summary>
7+
/// Migrates the property value using the <see cref="Constants.PropertyEditors.Aliases.DropDownListFlexible" /> editor containing prevalues (seperated by <see cref="PrevaluePropertyTypeMigratorBase.Delimiter" />) from Umbraco 7 to a JSON array.
8+
/// </summary>
9+
public sealed class DropDownListFlexiblePropertyTypeMigrator : PrevaluePropertyTypeMigratorBase
10+
{
11+
/// <inheritdoc />
12+
protected override bool Multiple => true;
13+
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="DropDownListFlexiblePropertyTypeMigrator" /> class.
16+
/// </summary>
17+
/// <param name="jsonSerializer">The JSON serializer.</param>
18+
public DropDownListFlexiblePropertyTypeMigrator(IJsonSerializer jsonSerializer)
19+
: base(Constants.PropertyEditors.Aliases.DropDownListFlexible, jsonSerializer)
20+
{ }
21+
}

src/Umbraco.Deploy.Contrib/Migrators/Legacy/Content/DropDownListFlexiblePropertyValueArtifactMigrator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using Umbraco.Cms.Core;
23
using Umbraco.Cms.Core.Serialization;
34
using Umbraco.Cms.Core.Services;
@@ -9,6 +10,7 @@ namespace Umbraco.Deploy.Contrib.Migrators.Legacy;
910
/// <summary>
1011
/// Migrates the <see cref="PropertyValueWithSegments" /> using the <see cref="Constants.PropertyEditors.Aliases.DropDownListFlexible" /> editor from the <see cref="ContentArtifactBase" /> containing prevalues (seperated by <see cref="PrevaluePropertyValueArtifactMigratorBase.Delimiter" />) from Umbraco 7 to a JSON array.
1112
/// </summary>
13+
[Obsolete("Migrating property values in an artifact migrator does not support nested/recursive properties. Use the PrevalueArtifactMigrator and DropDownListFlexiblePropertyTypeMigrator instead. This class will be removed in a future version.")]
1214
public class DropDownListFlexiblePropertyValueArtifactMigrator : PrevaluePropertyValueArtifactMigratorBase
1315
{
1416
/// <inheritdoc />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Umbraco.Cms.Core;
2+
using Umbraco.Cms.Core.Serialization;
3+
4+
namespace Umbraco.Deploy.Contrib.Migrators.Legacy;
5+
6+
/// <summary>
7+
/// Migrates the property value from the legacy <see cref="FromEditorAlias" /> editor containing prevalues (seperated by <see cref="PrevaluePropertyTypeMigratorBase.Delimiter" />) from Umbraco 7 to a JSON array.
8+
/// </summary>
9+
public sealed class DropDownMultiplePropertyTypeMigrator : PrevaluePropertyTypeMigratorBase
10+
{
11+
private const string FromEditorAlias = "Umbraco.DropDownMultiple";
12+
13+
/// <inheritdoc />
14+
protected override bool Multiple => true;
15+
16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="DropDownMultiplePropertyTypeMigrator" /> class.
18+
/// </summary>
19+
/// <param name="jsonSerializer">The JSON serializer.</param>
20+
public DropDownMultiplePropertyTypeMigrator(IJsonSerializer jsonSerializer)
21+
: base(FromEditorAlias, Constants.PropertyEditors.Aliases.DropDownListFlexible, jsonSerializer)
22+
{ }
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Umbraco.Cms.Core;
2+
using Umbraco.Cms.Core.Serialization;
3+
4+
namespace Umbraco.Deploy.Contrib.Migrators.Legacy;
5+
6+
/// <summary>
7+
/// Migrates the property value from the legacy <see cref="FromEditorAlias" /> editor containing prevalues (seperated by <see cref="PrevaluePropertyTypeMigratorBase.Delimiter" />) from Umbraco 7 to a JSON array.
8+
/// </summary>
9+
public sealed class DropDownPropertyTypeMigrator : PrevaluePropertyTypeMigratorBase
10+
{
11+
private const string FromEditorAlias = "Umbraco.DropDown";
12+
13+
/// <inheritdoc />
14+
protected override bool Multiple => true;
15+
16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="DropDownPropertyTypeMigrator" /> class.
18+
/// </summary>
19+
/// <param name="jsonSerializer">The JSON serializer.</param>
20+
public DropDownPropertyTypeMigrator(IJsonSerializer jsonSerializer)
21+
: base(FromEditorAlias, Constants.PropertyEditors.Aliases.DropDownListFlexible, jsonSerializer)
22+
{ }
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Umbraco.Cms.Core;
2+
using Umbraco.Cms.Core.Serialization;
3+
4+
namespace Umbraco.Deploy.Contrib.Migrators.Legacy;
5+
6+
/// <summary>
7+
/// Migrates the property value from the legacy <see cref="FromEditorAlias" /> editor containing prevalues (seperated by <see cref="PrevaluePropertyTypeMigratorBase.Delimiter" />) from Umbraco 7 to a JSON array.
8+
/// </summary>
9+
public sealed class DropdownlistMultiplePublishKeysPropertyTypeMigrator : PrevaluePropertyTypeMigratorBase
10+
{
11+
private const string FromEditorAlias = "Umbraco.DropdownlistMultiplePublishKeys";
12+
13+
/// <inheritdoc />
14+
protected override bool Multiple => true;
15+
16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="DropdownlistMultiplePublishKeysPropertyTypeMigrator" /> class.
18+
/// </summary>
19+
/// <param name="jsonSerializer">The JSON serializer.</param>
20+
public DropdownlistMultiplePublishKeysPropertyTypeMigrator(IJsonSerializer jsonSerializer)
21+
: base(FromEditorAlias, Constants.PropertyEditors.Aliases.DropDownListFlexible, jsonSerializer)
22+
{ }
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Umbraco.Cms.Core;
2+
using Umbraco.Cms.Core.Serialization;
3+
4+
namespace Umbraco.Deploy.Contrib.Migrators.Legacy;
5+
6+
/// <summary>
7+
/// Migrates the property value from the legacy <see cref="FromEditorAlias" /> editor containing prevalues (seperated by <see cref="PrevaluePropertyTypeMigratorBase.Delimiter" />) from Umbraco 7 to a JSON array.
8+
/// </summary>
9+
public sealed class DropdownlistPublishingKeysPropertyTypeMigrator : PrevaluePropertyTypeMigratorBase
10+
{
11+
private const string FromEditorAlias = "Umbraco.DropdownlistPublishingKeys";
12+
13+
/// <inheritdoc />
14+
protected override bool Multiple => true;
15+
16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="DropdownlistPublishingKeysPropertyTypeMigrator" /> class.
18+
/// </summary>
19+
/// <param name="jsonSerializer">The JSON serializer.</param>
20+
public DropdownlistPublishingKeysPropertyTypeMigrator(IJsonSerializer jsonSerializer)
21+
: base(FromEditorAlias, Constants.PropertyEditors.Aliases.DropDownListFlexible, jsonSerializer)
22+
{ }
23+
}

0 commit comments

Comments
 (0)