I have a table with several "brands" outside the umbraco tables. I want a way to link pages to specific brands. Currently I have a text field in the document type I am entering the corresponding brand ID. then in my surface controller I do this
var BrandsPage = Umbraco.TypedContent(1208);
var umbBrands = BrandsPage.Children;
var umbBrandPage = umbBrands.FirstOrDefault(x => x.brandID == brand.BrandID);
brand.Link = umbBrandPage.Url
This is working fine, I would like a more elegant solution, but that is not really what I am looking for here. What I would like to do is hide that BrandID field when content users (besides admins) are editing content. I haven't found a way to do this with Umbraco "Out of the box", if there is that would be awesome, but if not is anything I can do to extend Umbraco to allow functionality like this.
Hide certain property editors from certain users
I have a table with several "brands" outside the umbraco tables. I want a way to link pages to specific brands. Currently I have a text field in the document type I am entering the corresponding brand ID. then in my surface controller I do this
This is working fine, I would like a more elegant solution, but that is not really what I am looking for here. What I would like to do is hide that BrandID field when content users (besides admins) are editing content. I haven't found a way to do this with Umbraco "Out of the box", if there is that would be awesome, but if not is anything I can do to extend Umbraco to allow functionality like this.
Hi Charlie,
May you can use the
EditorModelEventManager.SendingContentModel
event to remove the property when the user is not a admin.In this event you can tweak the display model that is sent to the browser.
More info here ; https://our.umbraco.org/documentation/Reference/Events/EditorModel-Events
Dave
My man! that was exactly what I was looking for.
Thanks so much.
Cool,
Can you some code how you did it ? Haven't used the event myself.
Dave
Hi, following up on that topic. we´re using Umbraco 9, so I guess we need to use SendingContentNotification https://our.umbraco.com/documentation/Reference/Notifications/EditorModel-Notifications/
So when an article is called
Is there a simpler way, some plugin that does that?
Best, Gerhard
Hi Gerhard
Perhaps you can use or get some inspiration from this thread
https://our.umbraco.com/forum/umbraco-9/106763-hideremove-property-via-notificationeditoremodel
Hope this helps,
/Dennis
is working on a reply...