A really nice API enhancement would be if notifications_user_form() could handle more than one field. Currently, in notifications.module, it just grabs the first field in the list:
function notifications_user_form($form_state, $account, $type, $subscriptions, $list, $defaults, $options = array()) {
// Complete defaults
$info = notifications_subscription_types($type);
$field = $info['fields'][0];
Two examples where this would be useful is the og_notifications module, and the notificatons_location that I've been working on. og_notifications took the approach of implementing it's own subscription form. The result is quite a bit of duplicated code:
/**
* Menu callback: Group and grouptype subscription management form. This should
* ideally play nicer with notifications_user_form. However, due to issues with
* support for multi-field subscriptions, it is currently going about things in
* a roundabout manner.
*/
Thanks!
Comments
Comment #1
jose reyero commentedI think the best option for that form is to be completely obsoleted and maybe build a new one.
Anyway, you don't even need that form now. Adding the right parameters to hook_notifications('subscription fields') they'll be handled automatically. You can define autocomplete callbacks and lists of values for the fields. See notifications_content about that.
Comment #2
jose reyero commentedDone for 4.x, not to be backported