dpi / courier

Courier is a Drupal module providing a framework to send messages to entities.
https://drupal.org/project/courier
GNU General Public License v2.0
8 stars 3 forks source link

Courier Context should not be config, use a code based discovery #29

Open edurenye opened 8 years ago

edurenye commented 8 years ago

Courier Context should not be config, use a code based discovery, otherwise if for example we have it set in config and we want to add a new token we will need to add an upgrade path.

mirodietiker commented 8 years ago

With code based discovery we mean either use annotation or a hook.

Please elaborate on why the context is currently a config to allow us understand the use case / value.

dpi commented 8 years ago

Overall you are probably correct. CC should be a hook/registry system. But other than the need to re-implement, what benefits do you aim to gain from doing this?

Are you planning to add additional metadata to the contexts?

mirodietiker commented 8 years ago

It's about the severe problem Eduard described:

I start with a mail containing one token. As a module i would thus provide default config to register the context to have it installed.

Then i learn that i need to extend tokens for that context. I extend the code with the new context. I would expect that after flushing the cache, the token can be used. But no, i need to provide an update function to update the config based context. That's source for many pain points in maintenance and agility in mail management. Adding a new token is a common operation.

dpi commented 8 years ago

Good answer :+1:

dpi commented 8 years ago

I have left out context from #30 until we decide how to proceed with this issue. Fortunately you still automatically get site-wide and identity contexts for global template collections