I'm writing pluggable system. For a given name, I want to test if there is defined class pluginActionName. If it is, I want to create an instance of it. If it's not, I want to create an instance of pluginAction (parent class for all pluginAction* classes). That's the easy part, and Drupal unrelated.
Difficult about Drupal is to know when classes are defined. Can I rely on class_exists
- in my .inc code outside actual class? no?
- in initializers for static properties? no?
- in static methods of my class? sometimes?
- in dynamic methods of my class? yes?
- in helper functions that will be called by methods? only if it would be OK in method?
In italics is what I figured out so far, but I'm not sure about this and I cannot figure out exact loading order to tell why it's the way it is reliably.