https://github.com/umbraco/Umbraco-CMS/issues/10054 - Added TreeAlias to the remaining tree notifications

This commit is contained in:
Bjarke Berg
2021-03-25 07:05:08 +01:00
parent 69548e0b33
commit 8d61b3f067
3 changed files with 16 additions and 4 deletions

View File

@@ -17,6 +17,11 @@ namespace Umbraco.Cms.Web.BackOffice.Trees
/// </summary>
public string NodeId { get; }
/// <summary>
/// The alias of the tree the menu is rendering for
/// </summary>
public string TreeAlias { get; }
/// <summary>
/// The menu being rendered
/// </summary>
@@ -27,11 +32,12 @@ namespace Umbraco.Cms.Web.BackOffice.Trees
/// </summary>
public FormCollection QueryString { get; }
public MenuRenderingNotification(string nodeId, MenuItemCollection menu, FormCollection queryString)
public MenuRenderingNotification(string nodeId, MenuItemCollection menu, FormCollection queryString, string treeAlias)
{
NodeId = nodeId;
Menu = menu;
QueryString = queryString;
TreeAlias = treeAlias;
}
}
}

View File

@@ -14,15 +14,21 @@ namespace Umbraco.Cms.Web.BackOffice.Trees
/// </summary>
public TreeNode Node { get; }
/// <summary>
/// The alias of the tree the menu is rendering for
/// </summary>
public string TreeAlias { get; }
/// <summary>
/// The query string of the current request
/// </summary>
public FormCollection QueryString { get; }
public RootNodeRenderingNotification(TreeNode node, FormCollection queryString)
public RootNodeRenderingNotification(TreeNode node, FormCollection queryString, string treeAlias)
{
Node = node;
QueryString = queryString;
TreeAlias = treeAlias;
}
}
}

View File

@@ -111,7 +111,7 @@ namespace Umbraco.Cms.Web.BackOffice.Trees
if (IsDialog(queryStrings))
node.RoutePath = "#";
await _eventAggregator.PublishAsync(new RootNodeRenderingNotification(node, queryStrings));
await _eventAggregator.PublishAsync(new RootNodeRenderingNotification(node, queryStrings, TreeAlias));
return node;
}
@@ -171,7 +171,7 @@ namespace Umbraco.Cms.Web.BackOffice.Trees
var menu = menuResult.Value;
//raise the event
await _eventAggregator.PublishAsync(new MenuRenderingNotification(id, menu, queryStrings));
await _eventAggregator.PublishAsync(new MenuRenderingNotification(id, menu, queryStrings, TreeAlias));
return menu;
}