Skip to content
Snippets Groups Projects
Commit 414ec271 authored by Navneet Singh's avatar Navneet Singh Committed by Navneet Singh
Browse files

Merge pull request #3030 from goalgorilla/issue/vbo-action-is-not-selected

Issue #3295361 by Ressinel, zanvidmar: The user export VBO action is not enabled on some sites.
parent 7aa1d74d
No related branches found
No related tags found
No related merge requests found
......@@ -47,20 +47,33 @@ function _social_group_members_export_alter_group_manage_members_view(): void {
$config->save();
}
/**
* The emptied hook.
*/
function social_group_members_export_update_11001(array &$sandbox): void {
// Moved to separate sequential update hook.
// @see: social_group_members_export_update_11002
}
/**
* Adds custom action in 'views.view.group_manage_members' after VBO updates.
*
* Action ID: 'social_group_members_export_member_action'.
*/
function social_group_members_export_update_11001(array &$sandbox): void {
function social_group_members_export_update_11002(): void {
$config = \Drupal::configFactory()->getEditable('views.view.group_manage_members');
$selected_actions = $config->get('display.default.display_options.fields.social_views_bulk_operations_bulk_form_group.selected_actions');
$selected_actions[] = [
'action_id' => 'social_group_members_export_member_action',
'preconfiguration' => [
'label_override' => t('Export'),
],
];
$config->set('display.default.display_options.fields.social_views_bulk_operations_bulk_form_group.selected_actions', $selected_actions);
$config->save();
// We have to check if action is already added.
$action = array_search('social_group_members_export_member_action', array_column($selected_actions, 'action_id'), FALSE);
// If action is not added we add it.
if ($action === FALSE) {
$selected_actions[] = [
'action_id' => 'social_group_members_export_member_action',
'preconfiguration' => [
'label_override' => t('Export'),
],
];
$config->set('display.default.display_options.fields.social_views_bulk_operations_bulk_form_group.selected_actions', $selected_actions);
$config->save();
}
}
......@@ -947,18 +947,11 @@ function social_group_update_11002(array &$sandbox): void {
}
/**
* Add 'social_group_add_members_to_group_action'.
*
* Update 'views.view.user_admin_people' after VBO module updates.
* The emptied hook.
*/
function social_group_update_11003(array &$sandbox): void {
$config = \Drupal::configFactory()->getEditable('views.view.user_admin_people');
$selected_actions = $config->get('display.default.display_options.fields.views_bulk_operations_bulk_form.selected_actions');
$selected_actions[] = [
'action_id' => 'social_group_add_members_to_group_action',
];
$config->set('display.default.display_options.fields.views_bulk_operations_bulk_form.selected_actions', $selected_actions);
$config->save();
// Moved to separate sequential update hook.
// @see: social_group_update_11005
}
/**
......@@ -974,3 +967,23 @@ function social_group_update_11004(): string {
// Output logged messages to related channel of update execution.
return $updateHelper->logger()->output();
}
/**
* Add 'social_group_add_members_to_group_action'.
*
* Update 'views.view.user_admin_people' after VBO module updates.
*/
function social_group_update_11005(): void {
$config = \Drupal::configFactory()->getEditable('views.view.user_admin_people');
$selected_actions = $config->get('display.default.display_options.fields.views_bulk_operations_bulk_form.selected_actions');
// We have to check if action is already added.
$action = array_search('social_group_add_members_to_group_action', array_column($selected_actions, 'action_id'), FALSE);
// If action is not added we add it.
if ($action === FALSE) {
$selected_actions[] = [
'action_id' => 'social_group_add_members_to_group_action',
];
$config->set('display.default.display_options.fields.views_bulk_operations_bulk_form.selected_actions', $selected_actions);
$config->save();
}
}
......@@ -61,20 +61,33 @@ function _social_user_export_alter_user_admin_people_view(): void {
$config->save();
}
/**
* The emptied hook.
*/
function social_user_export_update_11001(array &$sandbox): void {
// Moved to separate sequential update hook.
// @see: social_user_export_update_11002
}
/**
* Adds custom action in views.view.user_admin_people after VBO updates.
*
* Action ID: 'social_user_export_enrollments_action' action.
* Action ID: 'social_user_export_user_action' action.
*/
function social_user_export_update_11001(array &$sandbox): void {
function social_user_export_update_11002(array &$sandbox): void {
$config = \Drupal::configFactory()->getEditable('views.view.user_admin_people');
$selected_actions = $config->get('display.default.display_options.fields.views_bulk_operations_bulk_form.selected_actions');
$selected_actions[] = [
'action_id' => 'social_user_export_user_action',
'preconfiguration' => [
'label_override' => '',
],
];
$config->set('display.default.display_options.fields.views_bulk_operations_bulk_form.selected_actions', $selected_actions);
$config->save();
// We have to check if action is already added.
$action = array_search('social_user_export_user_action', array_column($selected_actions, 'action_id'), FALSE);
// If action is not added we add it.
if ($action === FALSE) {
$selected_actions[] = [
'action_id' => 'social_user_export_user_action',
'preconfiguration' => [
'label_override' => '',
],
];
$config->set('display.default.display_options.fields.views_bulk_operations_bulk_form.selected_actions', $selected_actions);
$config->save();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment