You are here

function oa_core_og_group_ref_views_handler_filter_in_operator::exposed_form in Open Atrium Core 7.2

Render our chunk of the exposed filter form when selecting.

You can override this if it doesn't do what you expect.

Overrides views_handler_filter::exposed_form

File

plugins/views/oa_core_og_group_ref_views_handler_filter_in_operator.inc, line 24
Code to override field to add in auto option.

Class

oa_core_og_group_ref_views_handler_filter_in_operator
@file Code to override field to add in auto option.

Code

function exposed_form(&$form, &$form_state) {
  parent::exposed_form($form, $form_state);
  global $user;
  $exposed = $this->view
    ->get_exposed_input();

  // just call OG for spaces, we don't care about subspaces
  // really we just need a count, but at least this doesn't load every space
  $groups = og_get_groups_by_user($user, 'node');
  if (($id = $this->options['expose']['identifier']) && $groups && !empty($form[$id]['#options']) && array_intersect_key($groups, $form[$id]['#options'])) {
    $form[$id . '_mine'] = array(
      '#title' => t('My Spaces'),
      '#default_value' => 0,
      '#type' => 'checkbox',
    );
    if (!empty($exposed[$id . '_mine'])) {
      $form[$id]['#access'] = FALSE;

      // Need to set it here else the value is ignored when access is FALSE.
      if (!empty($exposed[$id])) {
        $form[$id]['#value'] = $exposed[$id];
      }
    }
  }
}