Files
Umbraco-CMS/src/Umbraco.Web/Trees/LanguageTreeController.cs

46 lines
1.6 KiB
C#
Raw Normal View History

using System.Net.Http.Formatting;
2019-11-05 12:54:22 +01:00
using Umbraco.Core;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi.Filters;
2019-11-05 13:45:42 +01:00
using Constants = Umbraco.Core.Constants;
namespace Umbraco.Web.Trees
{
[UmbracoTreeAuthorize(Constants.Trees.Languages)]
2019-01-22 09:31:47 +01:00
[Tree(Constants.Applications.Settings, Constants.Trees.Languages, SortOrder = 11, TreeGroup = Constants.Trees.Groups.Settings)]
[PluginController("UmbracoTrees")]
2019-01-22 09:31:47 +01:00
[CoreTree]
public class LanguageTreeController : TreeController
{
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
{
//We don't have any child nodes & only use the root node to load a custom UI
return new TreeNodeCollection();
}
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
//We don't have any menu item options (such as create/delete/reload) & only use the root node to load a custom UI
return null;
}
/// <summary>
/// Helper method to create a root model for a tree
/// </summary>
/// <returns></returns>
protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
{
var root = base.CreateRootNode(queryStrings);
//this will load in a custom UI instead of the dashboard for the root node
2019-11-05 13:45:42 +01:00
root.RoutePath = $"{Constants.Applications.Settings}/{Constants.Trees.Languages}/overview";
root.Icon = "icon-globe";
root.HasChildren = false;
root.MenuUrl = null;
return root;
}
}
}