Merge pull request #5041 from kjac/v8-feature-element-isvisible

V8: Add IsVisible extension on IPublishedElement
This commit is contained in:
Stephan
2019-04-09 21:20:37 +02:00
committed by GitHub

View File

@@ -170,5 +170,23 @@ namespace Umbraco.Web
}
#endregion
#region IsSomething
/// <summary>
/// Gets a value indicating whether the content is visible.
/// </summary>
/// <param name="content">The content.</param>
/// <returns>A value indicating whether the content is visible.</returns>
/// <remarks>A content is not visible if it has an umbracoNaviHide property with a value of "1". Otherwise,
/// the content is visible.</remarks>
public static bool IsVisible(this IPublishedElement content)
{
// rely on the property converter - will return default bool value, ie false, if property
// is not defined, or has no value, else will return its value.
return content.Value<bool>(Constants.Conventions.Content.NaviHide) == false;
}
#endregion
}
}