Files
Umbraco-CMS/src/Umbraco.Core/ContentApps/ContentInfoContentAppFactory.cs

56 lines
1.8 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.ContentEditing;
using Umbraco.Cms.Core.Models.Membership;
namespace Umbraco.Cms.Core.ContentApps
{
public class ContentInfoContentAppFactory : IContentAppFactory
{
2018-09-21 09:42:36 +02:00
// see note on ContentApp
private const int Weight = +100;
private ContentApp? _contentApp;
private ContentApp? _mediaApp;
private ContentApp? _memberApp;
public ContentApp? GetContentAppFor(object o, IEnumerable<IReadOnlyUserGroup> userGroups)
{
switch (o)
{
case IContent _:
return _contentApp ??= new ContentApp
{
Alias = "umbInfo",
Name = "Info",
Icon = "icon-info",
2018-09-21 09:42:36 +02:00
View = "views/content/apps/info/info.html",
Weight = Weight
};
case IMedia _:
return _mediaApp ??= new ContentApp
{
Alias = "umbInfo",
Name = "Info",
Icon = "icon-info",
2018-09-21 09:42:36 +02:00
View = "views/media/apps/info/info.html",
Weight = Weight
};
2019-12-18 10:43:41 +01:00
case IMember _:
return _memberApp ??= new ContentApp
2019-12-18 10:43:41 +01:00
{
Alias = "umbInfo",
Name = "Info",
Icon = "icon-info",
View = "views/member/apps/info/info.html",
Weight = Weight
};
default:
return null;
}
}
}
}