SocialGroupAdminPeopleConfigOverride.php in Open Social 8.8
Same filename and directory in other branches
- 8.9 modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php
- 8.5 modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php
- 8.6 modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php
- 8.7 modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php
- 10.3.x modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php
- 10.0.x modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php
- 10.1.x modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php
- 10.2.x modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php
Namespace
Drupal\social_groupFile
modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.phpView source
<?php
namespace Drupal\social_group;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Config\ConfigFactoryOverrideInterface;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
/**
* Class SocialGroupAdminPeopleConfigOverride.
*
* @package Drupal\social_group
*/
class SocialGroupAdminPeopleConfigOverride implements ConfigFactoryOverrideInterface {
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Constructs the configuration override.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*/
public function __construct(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
/**
* Load overrides.
*/
public function loadOverrides($names) {
$overrides = [];
$config_name = 'views.view.user_admin_people';
// Add AddMembersToGroup to VBO Admin people.
if (in_array($config_name, $names, TRUE)) {
$overrides[$config_name] = [
'display' => [
'default' => [
'display_options' => [
'fields' => [
'views_bulk_operations_bulk_form' => [
'selected_actions' => [
'social_group_add_members_to_group_action' => 'social_group_add_members_to_group_action',
],
],
],
],
],
],
];
}
$config_name = 'views.view.group_manage_members';
// Add all available group types on the platform here, so they can all
// make use of the new manage members overview.
if (in_array($config_name, $names, TRUE)) {
$social_group_types = [
'open_group',
'closed_group',
'public_group',
];
$this->moduleHandler
->alter('social_group_types', $social_group_types);
// Loop over all group types.
foreach ($social_group_types as $group_type) {
$membership = $group_type . '-group_membership';
// Add each group type to the filters of this overview.
$overrides[$config_name]['display']['default']['display_options']['filters']['type']['value'][$membership] = $membership;
}
}
return $overrides;
}
/**
* {@inheritdoc}
*/
public function getCacheSuffix() {
return 'SocialGroupAdminPeopleConfigOverride';
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($name) {
return new CacheableMetadata();
}
/**
* {@inheritdoc}
*/
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
return NULL;
}
}
Classes
Name | Description |
---|---|
SocialGroupAdminPeopleConfigOverride | Class SocialGroupAdminPeopleConfigOverride. |