Created
October 18, 2019 17:41
-
-
Save Jako/0679e1b23cb8f5c5494c6826eba0f6a9 to your computer and use it in GitHub Desktop.
MODX FormIt Email Selector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$selectField = $modx->getOption('emailSelectField', $scriptProperties, 'department'); | |
$selectTo = $modx->getOption('emailSelectTo', $scriptProperties, ''); | |
$selectTo = ($selectTo) ? explode(',', $selectTo) : array(); | |
if ($selectField && $selectTo) { | |
$selected = intval($hook->getValue($selectField)) - 1; | |
if ($selected && isset($selectTo[$selected])) { | |
$hook->formit->config['emailTo'] = $selectTo[$selected]; | |
} | |
} | |
return true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Switch the emailTo address on base of a select dropdown.
Snippet Properties:
Form Field: