You are here

class SocialGroupSecretConfigOverride in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php \Drupal\social_group_secret\SocialGroupSecretConfigOverride
  2. 8.6 modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php \Drupal\social_group_secret\SocialGroupSecretConfigOverride
  3. 8.7 modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php \Drupal\social_group_secret\SocialGroupSecretConfigOverride
  4. 8.8 modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php \Drupal\social_group_secret\SocialGroupSecretConfigOverride
  5. 10.3.x modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php \Drupal\social_group_secret\SocialGroupSecretConfigOverride
  6. 10.0.x modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php \Drupal\social_group_secret\SocialGroupSecretConfigOverride
  7. 10.1.x modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php \Drupal\social_group_secret\SocialGroupSecretConfigOverride

Class SocialGroupSecretConfigOverride.

@package Drupal\social_group_secret

Hierarchy

Expanded class hierarchy of SocialGroupSecretConfigOverride

2 string references to 'SocialGroupSecretConfigOverride'
SocialGroupSecretConfigOverride::getCacheSuffix in modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php
The string to append to the configuration static cache name.
social_group_secret.services.yml in modules/social_features/social_group/modules/social_group_secret/social_group_secret.services.yml
modules/social_features/social_group/modules/social_group_secret/social_group_secret.services.yml
1 service uses SocialGroupSecretConfigOverride
social_group_secret.config_override in modules/social_features/social_group/modules/social_group_secret/social_group_secret.services.yml
Drupal\social_group_secret\SocialGroupSecretConfigOverride

File

modules/social_features/social_group/modules/social_group_secret/src/SocialGroupSecretConfigOverride.php, line 15

Namespace

Drupal\social_group_secret
View source
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 = 'message.template.create_content_in_joined_group';
    if (in_array($config_name, $names, FALSE)) {
      $overrides[$config_name]['third_party_settings']['activity_logger']['activity_bundle_entities'] = [
        'group_content-secret_group-group_node-event' => 'group_content-secret_group-group_node-event',
        'group_content-secret_group-group_node-topic' => 'group_content-secret_group-group_node-topic',
      ];
    }
    $config_name = 'message.template.join_to_group';
    if (in_array($config_name, $names, FALSE)) {
      $overrides[$config_name]['third_party_settings']['activity_logger']['activity_bundle_entities'] = [
        'group_content-secret_group-group_membership' => 'group_content-secret_group-group_membership',
      ];
    }
    $config_name = 'message.template.invited_to_join_group';
    if (in_array($config_name, $names, FALSE)) {
      $overrides[$config_name]['third_party_settings']['activity_logger']['activity_bundle_entities'] = [
        'group_content-secret_group-group_invitation' => 'group_content-secret_group-group_invitation',
      ];
    }
    $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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SocialGroupSecretConfigOverride::$configFactory protected property The config factory.
SocialGroupSecretConfigOverride::createConfigObject public function Creates a configuration object for use during install and synchronization. Overrides ConfigFactoryOverrideInterface::createConfigObject
SocialGroupSecretConfigOverride::getCacheableMetadata public function Gets the cacheability metadata associated with the config factory override. Overrides ConfigFactoryOverrideInterface::getCacheableMetadata
SocialGroupSecretConfigOverride::getCacheSuffix public function The string to append to the configuration static cache name. Overrides ConfigFactoryOverrideInterface::getCacheSuffix
SocialGroupSecretConfigOverride::loadOverrides public function Load overrides. Overrides ConfigFactoryOverrideInterface::loadOverrides
SocialGroupSecretConfigOverride::__construct public function Constructs the configuration override.