function mail_debugger_php_form in Mail Debugger 7.3
1 string reference to 'mail_debugger_php_form'
- mail_debugger_php_mail_debugger_info in modules/
php/ mail_debugger_php.module - Implement hook_mail_debugger_info();
File
- modules/
php/ includes/ php.mail_debugger.inc, line 3
Code
function mail_debugger_php_form($default_values = array()) {
if (!user_access('use mail debugger php')) {
return FALSE;
}
// which modules implement hook_mail?
$modules = module_implements('mail');
$contributed_modules = array();
// loop and add to list of candidates
foreach ($modules as $module) {
// Find the human readable name
$filename = drupal_get_path('module', $module) . "/{$module}.info";
$info = drupal_parse_info_file($filename);
// add to the list of candidates
$contributed_modules[$module] = $info['package'] . ' | ' . $info['name'];
}
// sort the values
asort($contributed_modules);
// add the module system name... for the geeks among us.
foreach ($contributed_modules as $module => $name) {
$contributed_modules[$module] = $name . ' (' . $module . ')';
}
// add contrib section of the form.
return array(
'info' => array(
'#markup' => '<p><big style="font-weight: bold;">Experimental feature!</big></p>',
),
'to' => array(
'#type' => 'textfield',
'#title' => t('E-mail address'),
'#default_value' => user_variable_get('mail_debugger_contrib_to'),
),
'module' => array(
'#type' => 'select',
'#title' => t('Module'),
'#default_value' => user_variable_get('mail_debugger_contrib_module'),
'#options' => $contributed_modules,
),
'key' => array(
'#type' => 'textfield',
'#title' => t('Mail key'),
'#default_value' => user_variable_get('mail_debugger_contrib_key'),
),
'param' => array(
'#type' => 'textarea',
'#title' => t('Param argument'),
'#description' => "PHP code to populate the \$param argument. do not use a <?php opening tag and return an array().",
'#default_value' => user_variable_get('mail_debugger_contrib_param'),
),
'language' => array(
'#type' => 'textfield',
'#title' => t('Language'),
'#default_value' => user_variable_get('mail_debugger_contrib_language'),
),
'from' => array(
'#type' => 'textfield',
'#title' => t('From'),
'#default_value' => user_variable_get('mail_debugger_contrib_from'),
),
'send' => array(
'#type' => 'checkbox',
'#title' => t('Send mail'),
'#default_value' => user_variable_get('mail_debugger_contrib_send'),
),
'submit' => array(
'#type' => 'submit',
'#name' => 'contrib_mail',
'#value' => t('Carefull please'),
'#submit' => array(
'mail_debugger_callback_submit_contrib_mail',
'mail_debugger_callback_submit',
),
'#validate' => array(
'mail_debugger_callback_valid_contrib_mail',
),
),
);
}