function webform_emails_form in Webform 7.3
Same name and namespace in other branches
- 6.3 includes/webform.emails.inc \webform_emails_form()
- 7.4 includes/webform.emails.inc \webform_emails_form()
Overview form of all components for this webform.
1 string reference to 'webform_emails_form'
- webform_menu in ./
webform.module - Implements hook_menu().
File
- includes/
webform.emails.inc, line 13 - Provides interface and database handling for e-mail settings of a webform.
Code
function webform_emails_form($form, $form_state, $node) {
module_load_include('inc', 'webform', 'includes/webform.components');
$form['#attached']['library'][] = array(
'webform',
'admin',
);
$form['#tree'] = TRUE;
$form['#node'] = $node;
$form['components'] = array();
$form['nid'] = array(
'#type' => 'value',
'#value' => $node->nid,
);
foreach ($node->webform['emails'] as $eid => $email) {
$email_addresses = array_filter(explode(',', $email['email']));
foreach ($email_addresses as $key => $email_address) {
$email_addresses[$key] = check_plain(webform_format_email_address($email_address, NULL, $node, NULL, FALSE));
}
$form['emails'][$eid]['email'] = array(
'#markup' => implode('<br />', $email_addresses),
);
$form['emails'][$eid]['subject'] = array(
'#markup' => check_plain(webform_format_email_subject($email['subject'], $node)),
);
$form['emails'][$eid]['from'] = array(
'#markup' => check_plain(webform_format_email_address($email['from_address'], $email['from_name'], $node, NULL, FALSE)),
);
}
$form['add'] = array(
'#theme' => 'webform_email_add_form',
'#tree' => FALSE,
);
$form['add']['email_option'] = array(
'#type' => 'radios',
'#options' => array(
'custom' => t('Address'),
'component' => t('Component value'),
),
'#default_value' => 'custom',
);
$form['add']['email_custom'] = array(
'#type' => 'textfield',
'#size' => 24,
'#maxlength' => 500,
);
$form['add']['email_component'] = array(
'#type' => 'select',
'#options' => webform_component_list($node, 'email_address', FALSE),
);
if (empty($form['add']['email_component']['#options'])) {
$form['add']['email_component']['#options'][''] = t('No available components');
$form['add']['email_component']['#disabled'] = TRUE;
}
$form['add_button'] = array(
'#type' => 'submit',
'#value' => t('Add'),
'#weight' => 45,
);
$form['#validate'] = array(
'webform_email_address_validate',
);
return $form;
}