That certainly got me further along.
Using some debugging I've been able to capture what is being sent into the snippet. This reveals my problem now: I am evidently passing to the snippet the name of the placeholder, not the value of it.
So, here's how I'm calling the snippet, and the modifications I made to the populate the ToWhom placeholder. How do I get the value of the [[+what]] placeholder into the snippet?
FormIt call:
[[$pvcVolunteerForm]]
[[!WhatToWho? &input=[[+what]] ]]
[[!FormIt? &hooks=`email,redirect`
&emailSubject=`Volunteer Contact`
&emailTpl=`pvcVolunteerEmail`
&redirectTo=`171`
&validate=`who:required,
email:email:required,
what:required,
when:required,
where:stripTags,
how:stripTags,
why:stripTags`
&emailTo=`[[+ToWhom]]`
]]
WhatToWho:
<?php
$modx->log(modX::LOG_LEVEL_DEBUG, $input);
if ($input == '') { return ''; }
$flags = explode(',',$input);
foreach ($flags as $key => $value) {
switch ($value)
{
case "ao":
$output[] = '[email protected]';
break;
case "ss":
$output[] = '[email protected]';
break;
case "sa":
$output[] = '[email protected]';
break;
default:
$output[] = '[email protected]';
}
}
$modx->log(modX::LOG_LEVEL_DEBUG, implode(', ', array_unique($output)));
$modx->setPlaceHolder('ToWhom', implode(', ', array_unique($output)));
The output to the error log is this:
[2011-10-21 13:01:29] (DEBUG @ /index.php) [[+what]]
[2011-10-21 13:01:29] (DEBUG @ /index.php) [email protected]