AI OnAI Off
Yes it is, the order of the initializers and the providers are unknown so you can't rely on other descriptors being there at that point.
In your case, the idea is to change the existing descriptors using an initializer module. When you get the descriptors in the example below, all initialization and registration should be completed.
[InitializableModule] [ModuleDependency(typeof(EPiServer.Cms.Shell.InitializableModule))] public class InitializationModule : IInitializableModule { public void Initialize(InitializationEngine context) { var registry = context.Locate.Advanced.GetInstance<UIDescriptorRegistry>(); foreach (var descriptor in registry.UIDescriptors) { descriptor.DefaultView = "formedit"; } } }
Hope this solves your problem.
I am trying to use a UIDescriptorProvider to register icon classes for my pages, this works... sometimes. If i disassemble the UIDescriptorRegistry class, the init method look like this:
Assuming the code above, whatever UIDescriptorProvider happen to come first, will register the uidescriptor and all that follows will be ignored as per the if-clause in the middle of the method.
Now, am I missing something here? Like a sortorder that determine in what order these should be registered. But even so, is this intended to be a battle? I suppose I could roll my own UIDescriptorRegistry, but I rather get some clarification if current behaviour is intended.
I have "solved" it temporary for now by using the obsolete IUIDescriptorInitializer interface & serviceconfig as those are initialized before any UIDescriptorProvider in the InitializeDescriptors method.
I would ideally like a "Update" method in the UIDescriptorRegistry, where I could just append a classname since that is all I want.