Files
Umbraco-CMS/src/Umbraco.Web.BackOffice/Controllers/IconController.cs
Nikolaj Geisle e762fa91bc V10: fix build warnings in Web.BackOffice (#12479)
* Run code cleanup

* Start manual run

* Finish dotnet format + manual cleanup

* Fix up after merge

* Fix substrings changed to [..]

Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk>
Co-authored-by: Zeegaan <nge@umbraco.dk>
2022-06-20 08:37:17 +02:00

34 lines
1.1 KiB
C#

using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Web.BackOffice.Filters;
using Umbraco.Cms.Web.Common.Attributes;
using Umbraco.Cms.Web.Common.Controllers;
namespace Umbraco.Cms.Web.BackOffice.Controllers;
[PluginController("UmbracoApi")]
[IsBackOffice]
[UmbracoRequireHttps]
[MiddlewareFilter(typeof(UnhandledExceptionLoggerFilter))]
public class IconController : UmbracoApiController
{
private readonly IIconService _iconService;
public IconController(IIconService iconService) => _iconService = iconService;
/// <summary>
/// Gets an IconModel containing the icon name and SvgString according to an icon name found at the global icons path
/// </summary>
/// <param name="iconName"></param>
/// <returns></returns>
public IconModel? GetIcon(string iconName) => _iconService.GetIcon(iconName);
/// <summary>
/// Gets a list of all svg icons found at at the global icons path.
/// </summary>
/// <returns></returns>
public IReadOnlyDictionary<string, string>? GetIcons() => _iconService.GetIcons();
}