Skip to content

Instantly share code, notes, and snippets.

@KevinJump
Last active September 29, 2023 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KevinJump/af307441296c81c0e6b8b50a2cad2b5b to your computer and use it in GitHub Desktop.
Save KevinJump/af307441296c81c0e6b8b50a2cad2b5b to your computer and use it in GitHub Desktop.
Move Publisher Section
using Microsoft.AspNetCore.Authorization;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Sections;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Trees;
using Umbraco.Cms.Web.BackOffice.Trees;
using Umbraco.Cms.Web.Common.Attributes;
using uSync.Publisher;
using uSync.Publisher.Configuration;
using uSync.Publisher.Controllers;
namespace uSync.SourceSite;
public class MovePublisherTreeComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.Sections().InsertAfter<SettingsSection,MySyncSection>();
builder.Trees()?
.RemoveTreeController<PublisherTreeController>();
}
}
public class MySyncSection : ISection
{
public string Alias => "sync";
public string Name => "Synchronisation";
}
[Authorize(Policy = PublisherAuthorizationPolcies.PublisherTreeAccess)]
[Tree("sync", "uSyncPublisher", TreeGroup = "uSync", TreeTitle = "uSync Publisher", SortOrder = 10)]
[PluginController("uSyncPublisher")]
public class ReplacementPublisherTreeController :
PublisherTreeController
{
public ReplacementPublisherTreeController(
ILocalizedTextService localizedTextService,
UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection,
IEventAggregator eventAggregator,
SyncPublishConfigService publishConfigService,
IMenuItemCollectionFactory menuItemCollectionFactory)
: base(localizedTextService, umbracoApiControllerTypeCollection, eventAggregator, publishConfigService, menuItemCollectionFactory)
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment