You are here

function spaces_dashboard_form_alter in Spaces 5.2

Same name and namespace in other branches
  1. 5 spaces_dashboard/spaces_dashboard.module \spaces_dashboard_form_alter()

File

spaces_dashboard/spaces_dashboard.module, line 49

Code

function spaces_dashboard_form_alter($form_id, &$form) {
  switch ($form_id) {
    case 'ucreate_user_form':
      context_set('spaces', 'feature', 'group_dashboard');
      break;
    case 'views_filters':

      // Switch nid text filter to a select
      if ($form['view']['#value']->name == 'spaces_group_dashboard') {
        global $user;
        $options = array(
          '**ALL**' => '-- ' . t('All of my groups') . ' --',
        );
        foreach ($user->og_groups as $gid => $group) {
          $options[$gid] = truncate_utf8($group['title'], 30, false, true);
        }
        $form['filter0'] = array(
          '#type' => 'select',
          '#options' => $options,
          '#default_value' => $_GET['filter0'] ? $_GET['filter0'] : '**ALL**',
        );
        $form['#action'] = 'group_dashboard';
      }
      break;
  }
}