You are here

function forward_form_alter in Forward 7.3

Same name and namespace in other branches
  1. 8.3 forward.module \forward_form_alter()
  2. 8 forward.module \forward_form_alter()
  3. 8.2 forward.module \forward_form_alter()
  4. 5 forward.module \forward_form_alter()
  5. 6 forward.module \forward_form_alter()
  6. 7 forward.module \forward_form_alter()
  7. 7.2 forward.module \forward_form_alter()

Implements hook_form_alter().

File

./forward.module, line 1095
Allows forwarding of entities by email, and provides a record of how often each has been forwarded.

Code

function forward_form_alter(&$form, $form_state, $form_id) {

  // Add the node-type settings option to activate the email this page link
  if ($form_id == 'node_type_form') {
    $form['workflow']['forward_node'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show forwarding link/form'),
      '#return_value' => 1,
      '#default_value' => variable_get('forward_node_' . $form['#node_type']->type, FALSE),
      '#description' => t('Display the link/form to forward the page to a friend. Further configuration is available on the !settings.', array(
        '!settings' => l(t('settings page'), 'admin/config/user-interface/forward'),
      )),
    );
  }
  elseif ($form_id == 'forward_form') {

    // Send overlay to AJAX form submit
    if (variable_get('forward_colorbox_enable', 0) && isset($_GET['overlay']) && $_GET['overlay'] == 'cboxnode') {
      $form['#prefix'] = '<div id="cboxNodeWrapper">';
      $form['#suffix'] = '</div>';
      $form['actions']['submit']['#id'] = 'cboxSubmit';
      $form['actions']['submit']['#ajax'] = array(
        'callback' => 'forward_js_submit',
        'wrapper' => 'cboxNodeWrapper',
        'method' => 'replace',
        'effect' => 'fade',
      );
    }
  }
}