Commit d4d8dfcd authored by Zan Vidmar's avatar Zan Vidmar
Browse files

Issue #3324811 by zanvidmar: Remove courses in the filter on the all groups page.

parent fbfddb29
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -901,10 +901,19 @@ function social_course_social_group_hide_types_alter(array &$hidden_types): void
 * Implements hook_form_FORM_ID_alter().
 */
function social_course_form_views_exposed_form_alter(array &$form, FormStateInterface $form_state): void {
  if ($form_state->get('view')->id() === 'search_content') {
  $view_id = $form_state->get('view')->id();

  if ($view_id === 'search_content') {
    foreach (['course_article', 'course_section', 'course_video'] as $type) {
      unset($form['type']['#options'][$type]);
    }
    return;
  }

  if ($view_id === 'newest_groups') {
    foreach (['course_advanced', 'course_basic'] as $type) {
      unset($form['type']['#options'][$type]);
    }
  }
}