You are here

function amp_node_form_submit in Accelerated Mobile Pages (AMP) 7

Same name and namespace in other branches
  1. 8.3 amp.module \amp_node_form_submit()
  2. 8 amp.module \amp_node_form_submit()
  3. 8.2 amp.module \amp_node_form_submit()

Submit handler for viewing the AMP page.

1 string reference to 'amp_node_form_submit'
amp_form_node_form_alter in ./amp.module
Implements hook_form_BASE_FORM_ID_alter().

File

./amp.module, line 400

Code

function amp_node_form_submit(&$form, $form_state) {
  if (!empty($form_state['node']->path['alias'])) {
    $current_path = $form_state['node']->path['alias'];
  }
  else {
    $current_path = 'node/' . $form_state['node']->nid;
  }

  // We need to remove destination if its there
  unset($_GET['destination']);

  // We must pass amp => null as there is no value to the amp parameter
  drupal_goto($current_path, array(
    'query' => array(
      'amp' => null,
    ),
  ));
}