Fixed DynamicBackingItem autodetection of Media used in NodeById, now you can use NodeById to get Media or Content nodes

This commit is contained in:
agrath
2011-08-17 21:27:09 -12:00
parent b023455068
commit c657236f7c

View File

@@ -30,17 +30,19 @@ namespace umbraco.MacroEngines
public DynamicBackingItem(int Id)
{
NodeFactory.Node baseNode = new NodeFactory.Node(Id);
//todo: trace this with media
if (baseNode == null)
this.content = baseNode;
this.Type = DynamicBackingItemType.Content;
if (baseNode.Id == 0 && Id != 0)
{
this.media = ExamineBackedMedia.GetUmbracoMedia(Id);
this.Type = DynamicBackingItemType.Media;
if (this.media == null)
{
this.Type = DynamicBackingItemType.Content;
}
return;
}
else
{
this.content = baseNode;
this.Type = DynamicBackingItemType.Content;
}
}
public DynamicBackingItem(int Id, DynamicBackingItemType Type)
{