AI OnAI Off
I also noted that if you set TargetType to the block, it only triggers for local blocks. I ended up switching up to using TargetType = typeof(ContentData) and then check in editor descriptor what type of content is being created. That works for shared blocks. Example to hide LinkUrl property on contact block for alloy site:
[EditorDescriptorRegistration(TargetType = typeof(ContentData))]
public class MoveFormsPropertyEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
var contentDataMetadata = (ContentDataMetadata)metadata;
if ((contentDataMetadata.Model as ContactBlock != null))
{
foreach (var metadataProperty in metadata.Properties)
{
var mp = metadataProperty;
if (mp.PropertyName == nameof(ContactBlock.LinkUrl))
{
mp.ShowForEdit = false;
}
}
}
}
}
I want to extend the group container for my block but when adding a EditorDescriptor it's executed when I use it as a local block but not as a shared block. What's the difference and how can I accomplish this with a shared block?