Interface INavigationManagementService
Placeholder for sharing logic between the document and media navigation services for managing the navigation structure.
Namespace: Umbraco.Cms.Core.Services.Navigation
Assembly: Umbraco.Core.dll
Syntax
public interface INavigationManagementService
Methods
View SourceAdd(Guid, Guid, Nullable<Guid>, Nullable<Int32>)
Adds a new node to the main navigation structure. If a parent key is provided, the new node is added as a child of the specified parent. If no parent key is provided, the new node is added at the root level.
Declaration
bool Add(Guid key, Guid contentTypeKey, Guid? parentKey = null, int? sortOrder = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | key | The unique identifier of the new node to add. |
Guid | contentTypeKey | The unique identifier of the node's content type. |
System.Nullable<Guid> | parentKey | The unique identifier of the parent node. If |
System.Nullable<System.Int32> | sortOrder | Optional value to define the node's position among its siblings when adding node at root level. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
The sort order is particularly important when adding nodes at the root level. For child nodes, it can usually be determined by the number of existing children under the parent. However, when adding nodes directly to the root (where parentKey is null), a sort order must be provided to ensure the item appears in the correct position among other root-level items.
Move(Guid, Nullable<Guid>)
Moves an existing node to a new parent in the main navigation structure. If a target parent key is provided, the node is moved under the specified parent. If no target parent key is provided, the node is moved to the root level.
Declaration
bool Move(Guid key, Guid? targetParentKey = null)
Parameters
Type | Name | Description |
---|---|---|
Guid | key | The unique identifier of the node to move. |
System.Nullable<Guid> | targetParentKey | The unique identifier of the new parent node. If |
Returns
Type | Description |
---|---|
System.Boolean |
|
MoveToBin(Guid)
Removes a node from the main navigation structure and moves it, along with its descendants, to the root of the recycle bin structure.
Declaration
bool MoveToBin(Guid key)
Parameters
Type | Name | Description |
---|---|---|
Guid | key | The unique identifier of the node to remove. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RebuildAsync()
Rebuilds the entire navigation structure by refreshing the navigation tree based on the current state of the underlying repository.
Declaration
Task RebuildAsync()
Returns
Type | Description |
---|---|
Task |
UpdateSortOrder(Guid, Int32)
Updates the sort order of a node in the main navigation structure. The sort order of other nodes in the same level will be adjusted accordingly.
Declaration
bool UpdateSortOrder(Guid key, int newSortOrder)
Parameters
Type | Name | Description |
---|---|---|
Guid | key | The unique identifier of the node to update. |
System.Int32 | newSortOrder | The new sort order for the node. |
Returns
Type | Description |
---|---|
System.Boolean |
|