You are here

class SocialMentionsConfigOverride in Open Social 10.2.x

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

Class SocialMentionsConfigOverride.

Example configuration override.

@package Drupal\social_mentions

Hierarchy

Expanded class hierarchy of SocialMentionsConfigOverride

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

File

modules/social_features/social_mentions/src/SocialMentionsConfigOverride.php, line 16

Namespace

Drupal\social_mentions
View source
class SocialMentionsConfigOverride implements ConfigFactoryOverrideInterface {

  /**
   * Returns config overrides.
   */
  public function loadOverrides($names) {
    $overrides = [];

    // Add mentions filter to Basic HTML text format.
    $config_name = 'filter.format.basic_html';
    if (in_array($config_name, $names)) {
      $config = \Drupal::service('config.factory')
        ->getEditable($config_name);
      $dependencies = $config
        ->getOriginal('dependencies.module');
      $overrides[$config_name]['dependencies']['module'] = $dependencies;
      $overrides[$config_name]['dependencies']['module'][] = 'mentions';
      $overrides[$config_name]['filters']['filter_mentions'] = [
        'id' => 'filter_mentions',
        'provider' => 'mentions',
        'status' => TRUE,
        'weight' => 40,
        'settings' => [
          'mentions_filter' => [
            'ProfileMention' => 1,
            'UserMention' => 1,
          ],
        ],
      ];
    }
    return $overrides;
  }

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

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