나는 Orchard 1.10.1
을 사용합니다.(ContentType/DisplayType) - 오차드의 레이아웃 모양 대신 사용
오차드에서 레이아웃 모양에 (ContentType
/DisplayType
) 특정 대체품을 만들 수 있습니까?
CustomContentType
의 레이아웃 대신 특정 대체가 필요합니다. Displaytype
세부 사항.
미리 감사드립니다.
나는 Orchard 1.10.1
을 사용합니다.(ContentType/DisplayType) - 오차드의 레이아웃 모양 대신 사용
오차드에서 레이아웃 모양에 (ContentType
/DisplayType
) 특정 대체품을 만들 수 있습니까?
CustomContentType
의 레이아웃 대신 특정 대체가 필요합니다. Displaytype
세부 사항.
미리 감사드립니다.
그것은 레이아웃 모양처럼 보이지 않는이 번갈아 상자에서 설정 한 :
당신이 것 그 다음 하나에 비트 Zone
를 아래로 스크롤하면 마지막에 Alternates를 추가하는 OnDisplaying()
이벤트 핸들러가 있음을 확인하십시오.
잘 모르겠지만이 기능을 지원하는 내장 트릭이 있는지 확실하지 않습니다. 내가 알지 못하는 "레이아웃"의 특별한 케이스가 없다고 가정하면 IShapeTableProvider
에 사용자의 요구 사항에 맞는 대체품을 추가 할 수 있습니다.
a tutorial over on Bertrands blog은 어떻게 할 수 있는지 몇 가지 아이디어를 설명합니다.
주석에서 사용자는이를 정렬하는 데 도움이 될 모양 추적기의 URL 대체 기능을 사용할 수 있음을 언급합니다.
public class LayoutAlternateProvider : ContentHandler
{
string contentType;
private readonly IWorkContextAccessor _workContextAccessor;
protected override void BuildDisplayShape(BuildDisplayContext context)
{
if (context.DisplayType == "Detail" && !IsWidget(context.ContentItem))
{
context.Layout.Metadata.Alternates.Add("Layout__" + context.ContentItem.ContentType);
}
}
private static bool IsWidget(ContentItem item)
{
return item.TypeDefinition.Settings.Any(setting => setting.Key == "Stereotype" && setting.Value == "Widget");
}
}
감사합니다, 좋은 가이드 : 여기 –