2021-03-19 16:17:39 +01:00
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Core.Models;
|
|
|
|
|
using Umbraco.Cms.Core.Services;
|
2021-03-19 16:17:39 +01:00
|
|
|
using Umbraco.Cms.Web.BackOffice.Filters;
|
2021-02-18 11:06:02 +01:00
|
|
|
using Umbraco.Cms.Web.Common.Attributes;
|
2021-03-19 16:17:39 +01:00
|
|
|
using Umbraco.Cms.Web.Common.Controllers;
|
2020-08-26 08:05:15 +02:00
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
namespace Umbraco.Cms.Web.BackOffice.Controllers
|
2020-08-26 08:05:15 +02:00
|
|
|
{
|
|
|
|
|
[PluginController("UmbracoApi")]
|
2021-03-19 16:17:39 +01:00
|
|
|
[IsBackOffice]
|
|
|
|
|
[UmbracoRequireHttps]
|
|
|
|
|
[MiddlewareFilter(typeof(UnhandledExceptionLoggerFilter))]
|
|
|
|
|
public class IconController : UmbracoApiController
|
2020-08-26 08:05:15 +02:00
|
|
|
{
|
2020-09-22 08:58:16 +02:00
|
|
|
private readonly IIconService _iconService;
|
2020-08-26 08:05:15 +02:00
|
|
|
|
2020-09-22 12:54:51 +02:00
|
|
|
public IconController(IIconService iconService)
|
2020-08-26 08:05:15 +02:00
|
|
|
{
|
2020-09-22 08:58:16 +02:00
|
|
|
_iconService = iconService;
|
2020-08-26 08:05:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <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>
|
2022-04-01 11:09:51 +02:00
|
|
|
public IconModel? GetIcon(string iconName)
|
2020-08-26 08:05:15 +02:00
|
|
|
{
|
2020-09-22 08:58:16 +02:00
|
|
|
return _iconService.GetIcon(iconName);
|
2020-08-26 08:05:15 +02:00
|
|
|
}
|
|
|
|
|
|
2021-03-19 16:17:39 +01:00
|
|
|
|
2020-08-26 08:05:15 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a list of all svg icons found at at the global icons path.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2022-04-01 11:09:51 +02:00
|
|
|
public IReadOnlyDictionary<string, string>? GetIcons() => _iconService.GetIcons();
|
2020-08-26 08:05:15 +02:00
|
|
|
}
|
2021-03-19 16:17:39 +01:00
|
|
|
|
|
|
|
|
|
2020-08-26 08:05:15 +02:00
|
|
|
}
|