diff --git a/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs index 030b485ccf3..f0edcfc0b4a 100644 --- a/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Localization; using OrchardCore.CustomSettings.Services; +using OrchardCore.Mvc.Utilities; using OrchardCore.Navigation; namespace OrchardCore.CustomSettings @@ -33,6 +34,8 @@ public Task BuildNavigationAsync(string name, NavigationBuilder builder) .Add(S["Settings"], settings => settings .Add(new LocalizedString(type.DisplayName, type.DisplayName), type.DisplayName.PrefixPosition(), layers => layers .Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = type.Name }) + .AddClass(type.Name.HtmlClassify()) + .Id(type.Name.HtmlClassify()) .Permission(Permissions.CreatePermissionForType(type)) .Resource(type.Name) .LocalNav() diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Utilities/StringExtensions.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Utilities/StringExtensions.cs index 6cfa9b24584..1a5691144e8 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Utilities/StringExtensions.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Utilities/StringExtensions.cs @@ -69,39 +69,6 @@ public static string Ellipsize(this string text, int characterCount, string elli return trimmed + ellipsis; } - public static string HtmlClassify(this string text) - { - if (string.IsNullOrWhiteSpace(text)) - return ""; - - var friendlier = text.CamelFriendly(); - - var result = new char[friendlier.Length]; - - var cursor = 0; - var previousIsNotLetter = false; - for (var i = 0; i < friendlier.Length; i++) - { - char current = friendlier[i]; - if (IsLetter(current) || (char.IsDigit(current) && cursor > 0)) - { - if (previousIsNotLetter && i != 0 && cursor > 0) - { - result[cursor++] = '-'; - } - - result[cursor++] = char.ToLowerInvariant(current); - previousIsNotLetter = false; - } - else - { - previousIsNotLetter = true; - } - } - - return new string(result, 0, cursor); - } - public static LocalizedString OrDefault(this string text, LocalizedString defaultValue) { return string.IsNullOrEmpty(text)