function email_mail_page in Email Field 5
Same name and namespace in other branches
- 6.2 email.module \email_mail_page()
- 6 email.module \email_mail_page()
- 7 email.module \email_mail_page()
The contact form page.
1 string reference to 'email_mail_page'
- email_menu in ./
email.module - Implementation of hook_menu().
File
- ./
email.module, line 211
Code
function email_mail_page($nid = null, $fieldname = null) {
if (empty($nid) || empty($fieldname)) {
drupal_not_found();
return;
}
$node = node_load(intval($nid));
if (!$node) {
drupal_not_found();
return;
}
// Validate field name
$types = content_types($node->type);
if (!isset($types['fields'][$fieldname]) || $types['fields'][$fieldname]['type'] != 'email' || $types['fields'][$fieldname]['display_settings']['teaser']['format'] != 'contact' && $types['fields'][$fieldname]['display_settings']['full']['format'] != 'contact') {
drupal_not_found();
return;
}
$field = $node->{$fieldname};
if (empty($field) || empty($field[0]['email'])) {
drupal_not_found();
return;
}
if (!flood_is_allowed('email', variable_get('email_hourly_threshold', 3))) {
$output = t("You cannot send more than %number messages per hour. Please try again later.", array(
'%number' => variable_get('email_hourly_threshold', 3),
));
}
else {
$output = drupal_get_form('email_mail_page_form');
}
return $output;
}