You are here

function commons_activity_streams_form_alter in Drupal Commons 7.3

Implements hook_form_alter().

File

modules/commons/commons_activity_streams/commons_activity_streams.module, line 9

Code

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

  // Customize the text on the filter for Activity landing page.
  if ($form_id == 'views_exposed_form' && $form['#id'] == 'views-exposed-form-commons-activity-streams-activity-panel-pane-3') {
    $form['following']['#options'][0] = t("activity I'm not following");
    $form['following']['#options'][1] = t("activity I'm following");
  }
  if ($form_id == 'edit_profile_user_profile_form') {

    // Store default values in form state storage for change detection.
    static $profile_form_state;
    if (!isset($profile_form_state)) {

      // Use a copy of $form and $form_state for prepare and process.
      $profile_form = array_merge(array(), $form);
      $profile_form_state = array_merge(array(), $form_state);
      drupal_prepare_form('edit_profile_user_profile_form', $profile_form, $profile_form_state);
      drupal_process_form('edit_profile_user_profile_form', $profile_form, $profile_form_state);
      $form_state['storage']['values'] = $profile_form_state['values'];
    }
    $form['#submit'][] = 'commons_activity_streams_user_profile_submit';
  }
}