Bloom.Book.Layout.EnsureLayoutIsAmongValidChoices C# (CSharp) Method

EnsureLayoutIsAmongValidChoices() private static method

private static EnsureLayoutIsAmongValidChoices ( HtmlDom dom, Layout layout, IFileLocator fileLocator ) : Layout
dom HtmlDom
layout Layout
fileLocator IFileLocator
return Layout
        private static Layout EnsureLayoutIsAmongValidChoices(HtmlDom dom, Layout layout, IFileLocator fileLocator)
        {
            var layoutChoices = SizeAndOrientation.GetLayoutChoices(dom, fileLocator);
            if (layoutChoices.Any(l => l.SizeAndOrientation.ClassName == layout.SizeAndOrientation.ClassName))
                return layout;
            return layoutChoices.Any() ?  layoutChoices.First() : layout;
        }