function forward_page in Forward 7.3
Same name and namespace in other branches
- 5 forward.module \forward_page()
- 6 forward.module \forward_page()
- 7 forward.module \forward_page()
- 7.2 forward.module \forward_page()
Callback function for the forward Page
3 string references to 'forward_page'
- forward_form_submit in ./
forward.module - Submit callback function for forward form submit
- forward_mail in ./
forward.module - Implements hook_mail().
- forward_menu in ./
forward.module - Implements hook_menu().
File
- ./
forward.module, line 347 - Allows forwarding of entities by email, and provides a record of how often each has been forwarded.
Code
function forward_page() {
global $language;
// Tell SEO to ignore this page (but don't generate the meta tag for an overlay)
if (variable_get('forward_link_noindex', 1) && !isset($_GET['overlay'])) {
$element = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'robots',
'content' => 'noindex, nofollow',
),
);
drupal_add_html_head($element, 'forward_meta_noindex');
}
// Get entity or path being forwarded
$path = $_GET['path'];
if (empty($path)) {
return t('No path was selected to forward');
}
if (url_is_external($path)) {
return t('You cannot forward an external URL.');
}
// Check permissions
$path = drupal_get_normal_path($path, $language->language);
$id = _forward_entity_from_path($path, $entity_type, $entity, $bundle);
if ($id && !entity_access('view', $entity_type, $entity)) {
return MENU_ACCESS_DENIED;
}
if (path_is_admin($path)) {
return MENU_ACCESS_DENIED;
}
// Set page title
if ($path == 'epostcard') {
$emailtype = 'postcard';
drupal_set_title(t(variable_get('forward_epostcard_title', 'Send an e-Postcard')));
}
else {
$emailtype = 'page';
drupal_set_title(t(variable_get('forward_email_title', 'Forward this page to a friend')));
}
// Theme the forward form
$entity_wrapper = $id ? entity_metadata_wrapper($entity_type, $entity) : NULL;
return theme('forward_' . $emailtype, array(
'entity_wrapper' => $entity_wrapper,
'form' => drupal_get_form('forward_form', $path, $entity_wrapper),
));
}