Skip to content

Commit

Permalink
Rename AddAdminMenu extension to AddAdminNode (OrchardCMS#15316)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored and urbanit committed Mar 18, 2024
1 parent 55c807a commit 99ba61f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/OrchardCore.Modules/OrchardCore.AdminMenu/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public override void ConfigureServices(IServiceCollection services)
services.AddDeployment<AdminMenuDeploymentSource, AdminMenuDeploymentStep, AdminMenuDeploymentStepDriver>();

// placeholder treeNode
services.AddAdminMenu<PlaceholderAdminNode, PlaceholderAdminNodeNavigationBuilder, PlaceholderAdminNodeDriver>();
services.AddAdminNode<PlaceholderAdminNode, PlaceholderAdminNodeNavigationBuilder, PlaceholderAdminNodeDriver>();

// link treeNode
services.AddAdminMenu<LinkAdminNode, LinkAdminNodeNavigationBuilder, LinkAdminNodeDriver>();
services.AddAdminNode<LinkAdminNode, LinkAdminNodeNavigationBuilder, LinkAdminNodeDriver>();
}
}
}
2 changes: 1 addition & 1 deletion src/OrchardCore.Modules/OrchardCore.Contents/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public class AdminMenuStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddAdminMenu<ContentTypesAdminNode, ContentTypesAdminNodeNavigationBuilder, ContentTypesAdminNodeDriver>();
services.AddAdminNode<ContentTypesAdminNode, ContentTypesAdminNodeNavigationBuilder, ContentTypesAdminNodeDriver>();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Modules/OrchardCore.Lists/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class AdminMenuStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddAdminMenu<ListsAdminNode, ListsAdminNodeNavigationBuilder, ListsAdminNodeDriver>();
services.AddAdminNode<ListsAdminNode, ListsAdminNodeNavigationBuilder, ListsAdminNodeDriver>();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
namespace OrchardCore.AdminMenu;
public static class AdminMenuExtensions
{
public static IServiceCollection AddAdminMenu<TNode, TNodeBuilder, TNodeDriver>(this IServiceCollection services)
public static IServiceCollection AddAdminNode<TNode, TNodeBuilder, TNodeDriver>(this IServiceCollection services)
where TNode : AdminNode, new()
where TNodeBuilder : class, IAdminNodeNavigationBuilder
where TNodeDriver : class, IDisplayDriver<MenuItem>
{
services.AddAdminMenu<TNode, TNodeBuilder>();
services.AddAdminNode<TNode, TNodeBuilder>();

services.AddScoped<IDisplayDriver<MenuItem>, TNodeDriver>();

return services;
}

public static IServiceCollection AddAdminMenu<TNode, TNodeBuilder>(this IServiceCollection services)
public static IServiceCollection AddAdminNode<TNode, TNodeBuilder>(this IServiceCollection services)
where TNode : AdminNode, new()
where TNodeBuilder : class, IAdminNodeNavigationBuilder
{
Expand Down
2 changes: 1 addition & 1 deletion src/docs/reference/modules/AdminMenu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Commonly the steps that you follow in order to do that are:
3. Optionally, you could implement a ViewModel to move info between the edit views and the driver.
4. Add a class that implements IAdminNodeNavigationBuilder. Its BuildNavigationAsync() method will be called by the AdminMenuNavigationProvidersCoordinator class when it is time to render the menu.
5. Create the views required to create and edit the admin nodes based on your node type.
6. Register the new services `services.AddAdminMenu<CustomAdminNode, CustomAdminNodeNavigationBuilder, CustomAdminNodeDriver>();`
6. Register the new services `services.AddAdminNode<CustomAdminNode, CustomAdminNodeNavigationBuilder, CustomAdminNodeDriver>();`

By convention you should store all these non-view classes on a "AdminNodes" folder. This is optional.

Expand Down
4 changes: 2 additions & 2 deletions src/docs/releases/1.9.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ change it to the following:
services.AddDeployment<AdminMenuDeploymentSource, AdminMenuDeploymentStep, AdminMenuDeploymentStepDriver>();
```

- If you are using a custom AdminMenu node, change how you register it by using the new `AddAdminMenu<>` extension. This extension adds a new service that is required for proper serialization. For instance, instead of registering your custom admin menu nodep like this:
- If you are using a custom AdminMenu node, change how you register it by using the new `AddAdminNode<>` extension. This extension adds a new service that is required for proper serialization. For instance, instead of registering your custom admin menu nodep like this:

```csharp
services.AddSingleton<IAdminNodeProviderFactory>(new AdminNodeProviderFactory<PlaceholderAdminNode>());
Expand All @@ -51,7 +51,7 @@ services.AddScoped<IDisplayDriver<MenuItem>, PlaceholderAdminNodeDriver>();
change it to the following:

```csharp
services.AddAdminMenu<PlaceholderAdminNode, PlaceholderAdminNodeNavigationBuilder, PlaceholderAdminNodeDriver>();
services.AddAdminNode<PlaceholderAdminNode, PlaceholderAdminNodeNavigationBuilder, PlaceholderAdminNodeDriver>();
```

- Any serializable object that contains a polymorphic property (a base type that can contain sub-classes instances) needs to register all possible sub-classes this way:
Expand Down

0 comments on commit 99ba61f

Please sign in to comment.