Closed (fixed)
Project:
Mime Mail
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 May 2012 at 09:49 UTC
Updated:
14 May 2017 at 14:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jamsilver commentedPatch attached
Comment #2
sgabe commentedI think it's meaningless to add $message as an extra parameter, since it has everyting we need, we should remove all the other parameters and use just that.
There are some other functions e.g mimemail_prepare_message() where we should replace the existing parameters to $message but that will be another issue.
Comment #3
sgabe commentedI am attaching an initial patch to use only
$messagefor themeing.Comment #4
jotha commentedThe patch attached in #3 is no longer valid for current versions. I attach a simple patch that I am using in a high-traffic site, which only include
$paramsvariable present indrupal_mailfunction call.Comment #5
sgabe commentedHere is a new patch against the current state of the development snapshot.
Comment #6
rooby commentedThis is definitely needed to be able to theme specific emails properly.
Is this something that will likely be committed to 7.x-1.x at some stage?
If so there will have to be a notice to users regarding the change as it could break people's overridden templates.
This would be avoidable by not removing the variables:
- * - $recipient: The recipient of the message
- * - $module: The sending module
- * - $key: The message identifier
from the template.
In which case it would reduce the risk of breaking things but it would be a good idea to have a notice anyway.
The patch is a great improvement though.
Comment #7
rooby commentedI have tested the patch in #5 and it works as expected.
From a code point of view it looks good too.
Comment #8
sgabe commented#2167937: Pass $params (or other fields from the original $message) to preprocess and the template file marked as a duplicate of this.
Patch in #5 still applies fine and needs review.
Comment #9
srdjan.marjanovic commentedI downloaded latest version of the module (version = "7.x-1.0-beta1+5-dev") and i have trouble applying patch. Does this patch still apply?
Comment #10
sgabe commentedRerolled patch attached.
Comment #11
rooby commentedAny comments on #6 in terms of not removing the variables vs removing them and writing a change notice?
Comment #12
sgabe commented@rooby, I think we should use only the $message variable for hook_theme() but would be a good idea to preserve $recipient, $module and $key variables in the template_preprocess() implementation.
Comment #13
rooby commentedYeah I agree, thanks.
Comment #14
greggadsdon commentedFor those who do want to take the approach from #1 but with the latest version of MimeMail, find a patch for that attached.
Comment #15
mpotter commentedI think #14 is super straight-forward and should be RTBC'd. This functionality is greatly needed and this issue is languishing.
We can debate whether to remove the existing variables (as in #10) separately. In fact, separating these approaches would be a good way to deprecate the old variables and give people time to update their existing hooks and template overrides.
Using patch #14 now in Open Atrium.
Comment #16
ptmkenny commentedI agree with #15. I was bashing my head against the wall trying to figure out how to get access to some variables when I should've just searched the issue queue to find this patch.
Comment #17
ultimikeI completely agree with mpotter and ptmkenny - this needs to be committed ASAP, it's necessary and useful functionality (and pretty amazing it isn't already part of MimeMail).
-mike
Comment #19
sgabe commentedCommitted, thanks!
Comment #21
sgabe commented#2576545: Rules variables are unavailable in template marked as a duplicate of this.