Skip to content

Commit

Permalink
check if devices element from layout XML is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
IhorRomanko committed Mar 6, 2019
1 parent 2b454fb commit b60235c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Sitecore.Support.315324/InjectCompositeComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ public class InjectCompositeComponents : Sitecore.XA.Feature.Composites.Pipeline
public override IList<XElement> GetDevices(XElement layoutXml, ID contextDeviceId)
{
List<XElement> devices = layoutXml.Descendants("d").ToList();
IList<XElement> list = FilterDevicesByDeviceId(devices, contextDeviceId);
if (!list.Any() && Context.Device.FallbackDevice != null)
if (devices.Any())
{
return GetDevices(layoutXml, Context.Device.FallbackDevice.ID);
IList<XElement> list = FilterDevicesByDeviceId(devices, contextDeviceId);
if (!list.Any() && Context.Device.FallbackDevice != null)
{
return GetDevices(layoutXml, Context.Device.FallbackDevice.ID);
}
return list;
}
return list;
return new List<XElement>();
}
}
}

0 comments on commit b60235c

Please sign in to comment.