Download & Extend

Allow drupal_alter to alter token values

Project:Mail Editor
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

Hello! Thanks for the much useful module!
There is functionality to use drupal_alter to change the token keys for each email template, but it was not possible to alter the actual values of those keys once the email is being sent.
This patch allows for this functionality. One can use hook_MAIL_TEMPLATE_ID_token_values_alter() to modify the values of each token key.
Please review!

AttachmentSize
token_values.patch608 bytes

Comments

#1

Status:needs review» needs work

Hooks defined by mail_edit should have a name of the form hook_mail_edit_whatever() to avoid potential name conflicts.

Does it make sense to put $mail['id'] into the hook name? This may force the hook client to implement a large number of hooks. For example, the Subscriptions module can easily define a dozen or more IDs (including one for each content type).

#2

I think it's related to #1501848: Alter tokens by $mailkey_obj->module issue.

#3

I propose to use that variants:

drupal_alter($mailkey_obj->module . '_mail_edit_tokens_list', $tokens, $mailkey_obj->id);
for alter token list, and

drupal_alter($mail_data->module . '_mail_edit_tokens_value', $tokens, $mail['id'], $mail);
for alter token values.

#4

I'm not sure it's a good idea to invest more effort into this, because it's a dead end. The D7 version uses [tokens] (now a core feature which is completely different) — the proprietary !tokens of Mail Editor for D6 are gone.

Any effort you invest into customizing your site based on the !tokens makes it more difficult to port your site to D7 in the future. If we added more hooks in D6 that don't exist in D7, we'd be leading our users down the wrong path.

#5

Status:needs work» closed (won't fix)
nobody click here