public void Handle(SendingContentNotification notification)
{
if (notification.Content.ContentTypeAlias.Equals(Page.ModelTypeAlias))
{
foreach (var variant in notification.Content.Variants)
{
var hideBreadcrumb = variant.Tabs.SelectMany(f => f.Properties)
.FirstOrDefault(f => f.Alias.InvariantEquals("hideBreadcrumb"));
if ((notification.Content.Path.Split(",").Length - 1) < 3)
{
hideBreadcrumb = null;
}
}
}
}
Setting the it to null does not work, setting the view to null works, however, throws an error as there is no null html for this and I'd rather not go down that approach
Hide/Remove Property via notification/editormodel
Is there a way to hide/remove a property via the notification handler? I can't seem to see any documentation -
https://our.umbraco.com/documentation/reference/Notifications/ https://our.umbraco.com/documentation/Reference/Notifications/EditorModel-Notifications/
However, previous posts for previous versions, suggests that it is/was possible to do so?
https://our.umbraco.com/forum/using-umbraco-and-getting-started/90497-hide-certain-property-editors-from-certain-users
https://our.umbraco.com/forum/contributing-to-umbraco-cms/95053-hide-properties-for-specific-user-groups
Thanks!
EDIT:
Code used -
Setting the it to null does not work, setting the view to null works, however, throws an error as there is no null html for this and I'd rather not go down that approach
Ended up manipulating this - https://github.com/janvanhelvoort/Umbraco-hide-properties/blob/develop/Source/Our.Umbraco.HideProperties/EventHandlers/EditorModelEventManagerEventHandler.cs
is working on a reply...