You are here

function amp_node_enabled_form_submit in Accelerated Mobile Pages (AMP) 7

Form callback to save the enabled status.

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

File

./amp.module, line 384

Code

function amp_node_enabled_form_submit(&$form, $form_state) {
  if (isset($form_state['node']->nid)) {
    $node_id = $form_state['node']->nid;
    if ($form_state['values']['amp_enabled'] == 1) {
      amp_db_enable_amp($node_id);
    }
    else {
      amp_db_disable_amp($node_id);
    }
    amp_clear_cache($node_id);
  }
}