You are here

class SocialGroupFlexibleGroupConfigOverride in Open Social 8.8

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

Class SocialGroupSecretConfigOverride.

@package Drupal\social_group_secret

Hierarchy

Expanded class hierarchy of SocialGroupFlexibleGroupConfigOverride

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

File

modules/social_features/social_group/modules/social_group_flexible_group/src/SocialGroupFlexibleGroupConfigOverride.php, line 15

Namespace

Drupal\social_group_flexible_group
View source
class SocialGroupFlexibleGroupConfigOverride 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 = [];

    // Add Content access views filter to exclude
    // nodes, with visibility group, placed in group you are not a member of.
    $config_names = [
      'views.view.latest_topics' => [
        'default',
        'page_latest_topics',
      ],
      'views.view.upcoming_events' => [
        'default',
        'block_community_events',
        'block_my_upcoming_events',
        'page_community_events',
        'upcoming_events_group',
      ],
    ];

    // Filter plugin for Flexible group node access.
    $filter_node_access = [
      'id' => 'flexible_group_node_access',
      'table' => 'node_access',
      'field' => 'flexible_group_node_access',
      'relationship' => 'none',
      'group_type' => 'group',
      'admin_label' => '',
      'operator' => '=',
      'value' => [],
      'group' => 1,
      'exposed' => FALSE,
      'expose' => [
        'operator_id' => '',
        'label' => '',
        'description' => '',
        'use_operator' => FALSE,
        'operator' => '',
        'identifier' => '',
        'required' => FALSE,
        'remember' => FALSE,
        'multiple' => FALSE,
        'remember_roles' => [
          'authenticated' => 'authenticated',
        ],
      ],
      'is_grouped' => FALSE,
      'group_info' => [
        'label' => '',
        'description' => '',
        'identifier' => '',
        'optional' => TRUE,
        'widget' => 'select',
        'multiple' => FALSE,
        'remember' => FALSE,
        'default_group' => 'All',
        'default_group_multiple' => [],
        'group_items' => [],
      ],
      'plugin_id' => 'flexible_group_node_access',
    ];
    foreach ($config_names as $config_name => $displays) {
      if (in_array($config_name, $names)) {

        // Loop through the displays.
        foreach ($displays as $display) {
          $overrides[$config_name]['display'][$display]['display_options']['filters']['flexible_group_node_access'] = $filter_node_access;
        }
      }
    }
    $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' => [
                    'flexible_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' => [
                        'flexible_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' => [
              'flexible_group-group_membership' => 'group.content_type.flexible_group-group_membership',
            ],
          ],
          'display' => [
            'default' => [
              'display_options' => [
                'filters' => [
                  'type' => [
                    'value' => [
                      'flexible_group-group_membership' => 'flexible_group-group_membership',
                    ],
                  ],
                ],
              ],
            ],
          ],
        ];
      }
    }
    $config_names = [
      'views.view.group_events' => 'flexible_group-group_node-event',
      'views.view.group_topics' => 'flexible_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' => [
                        'flexible_group' => 'flexible_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',
                ],
              ],
            ],
          ],
        ];
      }
    }
    $config_name = 'block.block.views_block__group_managers_block_list_managers';
    if (in_array($config_name, $names, FALSE)) {
      $overrides[$config_name] = [
        'visibility' => [
          'group_type' => [
            'group_types' => [
              'flexible_group' => 'flexible_group',
            ],
          ],
        ],
      ];
    }
    $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-flexible_group-group_node-event' => 'group_content-flexible_group-group_node-event',
        'group_content-flexible_group-group_node-topic' => 'group_content-flexible_group-group_node-topic',
      ];
    }

    // Send a notification when a person joins flexible groups.
    $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-flexible_group-group_membership' => 'group_content-flexible_group-group_membership',
      ];
    }
    $config_name = 'views.view.group_managers';
    if (in_array($config_name, $names, FALSE)) {
      $overrides[$config_name] = [
        'display' => [
          'default' => [
            'display_options' => [
              'filters' => [
                'group_roles_target_id_3' => [
                  'id' => 'group_roles_target_id_3',
                  'table' => 'group_content__group_roles',
                  'field' => 'group_roles_target_id',
                  'relationship' => 'group_content',
                  'group_type' => 'group',
                  'admin_label' => '',
                  'operator' => '=',
                  'value' => 'flexible_group-group_manager',
                  'group' => 1,
                  'exposed' => FALSE,
                  'expose' => [
                    'operator_id' => '',
                    'label' => '',
                    'description' => '',
                    'use_operator' => FALSE,
                    'operator' => '',
                    'identifier' => '',
                    'required' => FALSE,
                    'remember' => FALSE,
                    'multiple' => FALSE,
                    'remember_roles' => [
                      'authenticated' => 'authenticated',
                    ],
                    'placeholder' => '',
                  ],
                  'is_grouped' => FALSE,
                  'group_info' => [
                    'label' => '',
                    'description' => '',
                    'identifier' => '',
                    'optional' => TRUE,
                    'widget' => 'select',
                    'multiple' => FALSE,
                    'remember' => FALSE,
                    'default_group' => 'All',
                    'default_group_multiple' => [],
                    'group_items' => [],
                  ],
                  'plugin_id' => 'string',
                ],
              ],
            ],
          ],
        ],
      ];
    }
    return $overrides;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheSuffix() {
    return 'SocialGroupFlexibleGroupConfigOverride';
  }

  /**
   * {@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
SocialGroupFlexibleGroupConfigOverride::$configFactory protected property The config factory.
SocialGroupFlexibleGroupConfigOverride::createConfigObject public function Creates a configuration object for use during install and synchronization. Overrides ConfigFactoryOverrideInterface::createConfigObject
SocialGroupFlexibleGroupConfigOverride::getCacheableMetadata public function Gets the cacheability metadata associated with the config factory override. Overrides ConfigFactoryOverrideInterface::getCacheableMetadata
SocialGroupFlexibleGroupConfigOverride::getCacheSuffix public function The string to append to the configuration static cache name. Overrides ConfigFactoryOverrideInterface::getCacheSuffix
SocialGroupFlexibleGroupConfigOverride::loadOverrides public function Load overrides. Overrides ConfigFactoryOverrideInterface::loadOverrides
SocialGroupFlexibleGroupConfigOverride::__construct public function Constructs the configuration override.