You are here

function social_search_alter_groups_exposed_filter_block in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_search/social_search.module \social_search_alter_groups_exposed_filter_block()
  2. 8.7 modules/social_features/social_search/social_search.module \social_search_alter_groups_exposed_filter_block()
  3. 10.3.x modules/social_features/social_search/social_search.module \social_search_alter_groups_exposed_filter_block()
  4. 10.0.x modules/social_features/social_search/social_search.module \social_search_alter_groups_exposed_filter_block()
  5. 10.1.x modules/social_features/social_search/social_search.module \social_search_alter_groups_exposed_filter_block()
  6. 10.2.x modules/social_features/social_search/social_search.module \social_search_alter_groups_exposed_filter_block()

Implements hook_form_FORM_ID_alter().

Makes changes for the filter block on the groups search page.

1 call to social_search_alter_groups_exposed_filter_block()
social_search_form_views_exposed_form_alter in modules/social_features/social_search/social_search.module
Implements hook_form_FORM_ID_alter().

File

modules/social_features/social_search/social_search.module, line 76
The Social search module.

Code

function social_search_alter_groups_exposed_filter_block(&$form, FormStateInterface $form_state, $form_id) {
  $options = [
    '' => t('- Any -'),
  ];
  $group_types = GroupType::loadMultiple();

  /** @var \Drupal\group\Entity\GroupType $group_type */
  foreach ($group_types as $group_type) {
    $options[$group_type
      ->id()] = $group_type
      ->label();
  }
  $form['type'] = [
    '#type' => 'select',
    '#options' => $options,
  ];
}