removes fixme, adds comments and null checks
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
// fixme
|
||||
public static class ContentTypeBaseServiceProviderExtensions
|
||||
internal static class ContentTypeBaseServiceProviderExtensions
|
||||
{
|
||||
//TODO: Maybe this should just be on the IContentTypeBaseServiceProvider interface?
|
||||
public static IContentTypeComposition GetContentTypeOf(this IContentTypeBaseServiceProvider serviceProvider, IContentBase contentBase)
|
||||
=> serviceProvider.For(contentBase).Get(contentBase.ContentTypeId);
|
||||
{
|
||||
if (contentBase == null) throw new ArgumentNullException(nameof(contentBase));
|
||||
return serviceProvider.For(contentBase)?.Get(contentBase.ContentTypeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Umbraco.Core.Services.Implement
|
||||
|
||||
public IContentTypeBaseService For(IContentBase contentBase)
|
||||
{
|
||||
if (contentBase == null) throw new ArgumentNullException(nameof(contentBase));
|
||||
switch (contentBase)
|
||||
{
|
||||
case IContent _:
|
||||
|
||||
@@ -199,8 +199,8 @@ namespace Umbraco.Web.Macros
|
||||
Key = _inner.Key;
|
||||
|
||||
// TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current
|
||||
CreatorName = _inner.GetCreatorProfile().Name;
|
||||
WriterName = _inner.GetWriterProfile().Name;
|
||||
CreatorName = _inner.GetCreatorProfile()?.Name;
|
||||
WriterName = _inner.GetWriterProfile()?.Name;
|
||||
|
||||
var contentType = Current.Services.ContentTypeBaseServices.GetContentTypeOf(_inner);
|
||||
ContentType = Current.PublishedContentTypeFactory.CreateContentType(contentType);
|
||||
|
||||
Reference in New Issue
Block a user