mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-21 19:34:40 +08:00
#19380: Removing needless content type definition fetching from CommonPartHandler
Work Item: 19380 --HG-- branch : 1.x
This commit is contained in:
@@ -9,6 +9,7 @@ using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Security;
|
||||
using Orchard.Services;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
|
||||
namespace Orchard.Core.Common.Handlers {
|
||||
[UsedImplicitly]
|
||||
@@ -63,14 +64,12 @@ namespace Orchard.Core.Common.Handlers {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override void Activating(ActivatingContentContext context) {
|
||||
if (ContentTypeWithACommonPart(context.ContentType))
|
||||
if (ContentTypeWithACommonPart(context.Definition))
|
||||
context.Builder.Weld<ContentPart<CommonPartVersionRecord>>();
|
||||
}
|
||||
|
||||
protected bool ContentTypeWithACommonPart(string typeName) {
|
||||
protected bool ContentTypeWithACommonPart(ContentTypeDefinition contentTypeDefinition) {
|
||||
//Note: What about content type handlers which activate "CommonPart" in code?
|
||||
var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(typeName);
|
||||
|
||||
if (contentTypeDefinition != null)
|
||||
return contentTypeDefinition.Parts.Any(part => part.PartDefinition.Name == "CommonPart");
|
||||
|
||||
|
Reference in New Issue
Block a user