Skip to content

Commit

Permalink
Issue #3474659: Fix filters for "All groups" view.
Browse files Browse the repository at this point in the history
  • Loading branch information
rochek03 authored and ribel committed Sep 19, 2024
1 parent dbb219b commit ef596b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 21 additions & 1 deletion modules/social_features/social_tagging/social_tagging.module
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ function social_tagging_form_views_exposed_form_alter(&$form, FormStateInterface
'views-exposed-form-group-topics-page-group-topics' => ['node_topic'],
'views-exposed-form-group-events-page-group-events' => ['node_event'],
'views-exposed-form-group-books-page-group-books' => ['node_topic'],
'views-exposed-form-newest-groups-page-all-groups' => ['group'],
'views-exposed-form-newest-groups-page-all-groups' => _social_tagging_get_group_placement_ids(),
'views-exposed-form-newest-users-page-newest-users' => ['profile'],
];
$form_ids = array_keys($keys);
Expand Down Expand Up @@ -741,3 +741,23 @@ function _social_tagging_field(): FieldStorageDefinitionInterface {
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
}

/**
* Get array of available "Placement ID" for groups.
*
* @return array
* The array of available "Placement ID" for groups.
*/
function _social_tagging_get_group_placement_ids(): array {
$group_bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo('group');

if (!$group_bundles) {
return [];
}

$group_bundles = array_keys($group_bundles);

return array_map(function ($group_bundle) {
return 'group_' . $group_bundle;
}, $group_bundles);
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['node_type_settings'][$key] = [
'#type' => 'checkbox',
'#title' => $title,
'#default_value' => $config->get($key) ?: !empty($bundles),
'#default_value' => $config->get($key),
];
}
}
Expand Down

0 comments on commit ef596b3

Please sign in to comment.