You are here

class SocialLanguageConfigOverride in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  2. 8.2 modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  3. 8.3 modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  4. 8.4 modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  5. 8.5 modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  6. 8.6 modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  7. 8.7 modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  8. 8.8 modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  9. 10.3.x modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  10. 10.0.x modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  11. 10.1.x modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride
  12. 10.2.x modules/custom/social_language/src/SocialLanguageConfigOverride.php \Drupal\social_language\SocialLanguageConfigOverride

Class SocialLanguageConfigOverride.

@package Drupal\social_language

Hierarchy

Expanded class hierarchy of SocialLanguageConfigOverride

2 string references to 'SocialLanguageConfigOverride'
SocialLanguageConfigOverride::getCacheSuffix in modules/custom/social_language/src/SocialLanguageConfigOverride.php
The string to append to the configuration static cache name.
social_language.services.yml in modules/custom/social_language/social_language.services.yml
modules/custom/social_language/social_language.services.yml
1 service uses SocialLanguageConfigOverride
social_language.override in modules/custom/social_language/social_language.services.yml
\Drupal\social_language\SocialLanguageConfigOverride

File

modules/custom/social_language/src/SocialLanguageConfigOverride.php, line 14

Namespace

Drupal\social_language
View source
class SocialLanguageConfigOverride implements ConfigFactoryOverrideInterface {

  /**
   * Load overrides.
   */
  public function loadOverrides($names) {
    $overrides = [];
    $config_factory = \Drupal::service('config.factory');

    // Override user form display.
    $config_name = 'core.entity_form_display.user.user.default';
    if (in_array($config_name, $names)) {
      $config = $config_factory
        ->getEditable($config_name);
      $children = $config
        ->get('third_party_settings.field_group.group_locale_settings.children');
      $children[] = 'language';
      $content = $config
        ->get('content');
      $content['language'] = [
        'weight' => 1,
        'region' => 'content',
        'settings' => [],
        'third_party_settings' => [],
      ];
      $hidden = $config
        ->get('hidden');
      unset($hidden['language']);
      $overrides[$config_name] = [
        'third_party_settings' => [
          'field_group' => [
            'group_locale_settings' => [
              'children' => $children,
            ],
          ],
        ],
        'content' => $content,
        'hidden' => $hidden,
      ];
    }
    return $overrides;
  }

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

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