SocialGroupSecretConfigOverride.php in Open Social 8.6
Same filename and directory in other branches
- 8.9 modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php
- 8.7 modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php
- 8.8 modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php
- 10.3.x modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php
- 10.0.x modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php
- 10.1.x modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php
- 10.2.x modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php
Namespace
Drupal\social_group_secretFile
modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.phpView source
<?php
namespace Drupal\social_group_secret;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\ConfigFactoryOverrideInterface;
use Drupal\Core\Config\StorageInterface;
/**
* Class SocialGroupSecretConfigOverride.
*
* @package Drupal\social_group_secret
*/
class SocialGroupSecretConfigOverride implements ConfigFactoryOverrideInterface {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs the configuration override.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
/**
* Load overrides.
*/
public function loadOverrides($names) {
$overrides = [];
$config_names = [
'search_api.index.social_all',
'search_api.index.social_groups',
];
foreach ($config_names as $config_name) {
if (in_array($config_name, $names)) {
$overrides[$config_name] = [
'field_settings' => [
'rendered_item' => [
'configuration' => [
'view_mode' => [
'entity:group' => [
'secret_group' => 'teaser',
],
],
],
],
],
];
}
}
$config_names = [
'views.view.search_all',
'views.view.search_groups',
];
foreach ($config_names as $config_name) {
if (in_array($config_name, $names)) {
$overrides[$config_name] = [
'display' => [
'default' => [
'display_options' => [
'row' => [
'options' => [
'view_modes' => [
'entity:group' => [
'secret_group' => 'teaser',
],
],
],
],
],
],
],
];
}
}
$config_names = [
'views.view.group_members',
'views.view.group_manage_members',
];
foreach ($config_names as $config_name) {
if (in_array($config_name, $names)) {
$overrides[$config_name] = [
'dependencies' => [
'config' => [
'secret_group-group_membership' => 'group.content_type.secret_group-group_membership',
],
],
'display' => [
'default' => [
'display_options' => [
'filters' => [
'type' => [
'value' => [
'secret_group-group_membership' => 'secret_group-group_membership',
],
],
],
],
],
],
];
}
}
$config_names = [
'views.view.group_events' => 'secret_group-group_node-event',
'views.view.group_topics' => 'secret_group-group_node-topic',
];
foreach ($config_names as $config_name => $content_type) {
if (in_array($config_name, $names)) {
$overrides[$config_name] = [
'dependencies' => [
'config' => [
'group-content-type' => 'group.content_type.' . $content_type,
'group-type' => 'group.type',
],
],
'display' => [
'default' => [
'display_options' => [
'arguments' => [
'gid' => [
'validate_options' => [
'bundles' => [
'secret_group' => 'secret_group',
],
],
],
],
'filters' => [
'type' => [
'value' => [
$content_type => $content_type,
],
],
],
],
],
],
];
}
}
$config_name = 'views.view.newest_groups';
$displays = [
'page_all_groups',
'block_newest_groups',
];
if (in_array($config_name, $names)) {
foreach ($displays as $display_name) {
$overrides[$config_name] = [
'display' => [
$display_name => [
'cache_metadata' => [
'contexts' => [
'user' => 'user',
],
],
],
],
];
}
}
return $overrides;
}
/**
* {@inheritdoc}
*/
public function getCacheSuffix() {
return 'SocialGroupSecretConfigOverride';
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata($name) {
return new CacheableMetadata();
}
/**
* {@inheritdoc}
*/
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
return NULL;
}
}
Classes
Name | Description |
---|---|
SocialGroupSecretConfigOverride | Class SocialGroupSecretConfigOverride. |