Search Results for

    Show / Hide Table of Contents
    View Source

    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 Source

    Add(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 null, the new node will be added to the root level.

    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

    true if the node was successfully added to the main navigation structure; otherwise, false.

    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.

    View Source

    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 null, the node will be moved to the root level.

    Returns
    Type Description
    System.Boolean

    true if the node and its descendants were successfully moved to the new parent in the main navigation structure; otherwise, false.

    View Source

    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

    true if the node and its descendants were successfully removed from the main navigation structure and added to the recycle bin; otherwise, false.

    View Source

    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
    View Source

    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

    true if the node's sort order was successfully updated; otherwise, false.

    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • Add(Guid, Guid, Nullable<Guid>, Nullable<Int32>)
      • Move(Guid, Nullable<Guid>)
      • MoveToBin(Guid)
      • RebuildAsync()
      • UpdateSortOrder(Guid, Int32)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX