AI OnAI Off
Hi Jason,
Have you tried this?
https://gregwiechec.com/2018/03/hide-tabs-and-properties-in-edit-mode/
If you are OK with having to save the page to update what properties are shown/hidden, you can do this completely without dojo. If you make the property that decides what properties to show required and don't intend to change it's value frequently - that could work.
Add an editor descriptor like this:
[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "hideiffoo")]
public class HidePropertyEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
base.ModifyMetadata(metadata, attributes);
var contentMetadata = (ContentDataMetadata)metadata;
var ownerContent = contentMetadata.OwnerContent;
var myPage = ownerContent as MyPageType;
if (myPage?.Foo)
{
metadata.ShowForEdit = false;
}
}
}
Then just add [UIHint("hideiffoo")] to the property you want to hide if the property Foo is true.
Kinda quick and dirty, but I think it will work.
The alloy plugin worked beautifully. It does it all for me. Exactly what i was looking for! Thanks guys.
I need to be able to toggle a few properties on and off based on the choice made in another property of the same page. I need it to update the all properties view as soon as a change is made to that property. I have been searching for a while for a simple way to do this, but all I am finding is many old solutions that take different approaches and I am not sure even work with the latest version of Episerver. Rather than go down any of those rabbie holes, I am hoping someone has some working examples of this they can share with me. Does anyone have a working example of this that they can post here that hopefully does not require a lot of work in dojo?