using Umbraco.Core.Composing;
using Umbraco.Web.BackOffice.Controllers;
using Umbraco.Web.Common.Controllers;
using Umbraco.Web.Common.Install;
using Umbraco.Web.BackOffice.Trees;
// the namespace here is intentional - although defined in Umbraco.Web assembly,
// this class should be visible when using Umbraco.Core.Components, alongside
// Umbraco.Core's own CompositionExtensions class
// ReSharper disable once CheckNamespace
namespace Umbraco.Extensions
{
///
/// Provides extension methods to the class.
///
public static class WebCompositionExtensions
{
#region Collection Builders
///
/// Gets the back office tree collection builder
///
///
///
public static TreeCollectionBuilder Trees(this Composition composition)
=> composition.WithCollectionBuilder();
#endregion
///
/// Registers Umbraco backoffice controllers.
///
public static Composition ComposeUmbracoBackOfficeControllers(this Composition composition)
{
composition.RegisterControllers(new []
{
typeof(BackOfficeController),
typeof(PreviewController),
typeof(AuthenticationController),
typeof(InstallController),
typeof(InstallApiController),
});
var umbracoAuthorizedApiControllers = composition.TypeLoader.GetTypes();
composition.RegisterControllers(umbracoAuthorizedApiControllers);
return composition;
}
}
}