Merge remote-tracking branch 'origin/v10/dev' into v11/dev

# Conflicts:
#	src/Umbraco.Core/Composing/BuilderCollectionBase.cs
This commit is contained in:
Bjarke Berg
2024-01-19 20:15:50 +01:00
20 changed files with 442 additions and 239 deletions

View File

@@ -19,6 +19,7 @@ using Umbraco.Cms.Core.Models.ContentEditing;
using Umbraco.Cms.Core.Models.Editors;
using Umbraco.Cms.Core.Models.Membership;
using Umbraco.Cms.Core.Models.Validation;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Cms.Core.Persistence.Querying;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.Routing;
@@ -683,17 +684,33 @@ public class ContentController : ContentControllerBase
[OutgoingEditorModelEvent]
public ActionResult<ContentItemDisplay?> GetEmptyBlueprint(int blueprintId, int parentId)
{
IContent? blueprint = _contentService.GetBlueprintById(blueprintId);
if (blueprint == null)
IContent? scaffold;
using (ICoreScope scope = _scopeProvider.CreateCoreScope())
{
return NotFound();
IContent? blueprint = _contentService.GetBlueprintById(blueprintId);
if (blueprint is null)
{
return NotFound();
}
scaffold = (IContent)blueprint.DeepClone();
scaffold.Id = 0;
scaffold.Name = string.Empty;
scaffold.ParentId = parentId;
var scaffoldedNotification = new ContentScaffoldedNotification(blueprint, scaffold, parentId, new EventMessages());
if (scope.Notifications.PublishCancelable(scaffoldedNotification))
{
scope.Complete();
return Problem("Scaffolding was cancelled");
}
scope.Complete();
}
blueprint.Id = 0;
blueprint.Name = string.Empty;
blueprint.ParentId = parentId;
ContentItemDisplay? mapped = _umbracoMapper.Map<ContentItemDisplay>(blueprint);
ContentItemDisplay? mapped = _umbracoMapper.Map<ContentItemDisplay>(scaffold);
if (mapped is not null)
{