Tie class extensions and code event listeners to options

Kirby

Well-known member
This will most likely end up with "Lack of interest", but I'm posting this anyway ;)

Sometimes some class extensios or code event listeners are only required if certain Add-on options are configured.

Usually such conditional checks are done by checking the option(s) within the classes / code event listeners and bypass code if the conditions are not met.
This is easy and does work just fine, but it seems kinda inefficient - especially for classs extensions or code event listeners that are called very often.

From a performance point of view it would be ideal if extensions classes / code event listeners would not be loaded at all if they are not required.
This is already doable via option validation code, but doing this seems tedious, eapecially when dealing with upgrades.

It would be awesome if it was possible to just define conditions for options which class extensions or code event listeners should be enabled/disabled.
 
Upvote 4
Top