You are here

class SocialEmbedConfigOverride in Open Social 8.2

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

Class SocialEmbedConfigOverride.

@package Drupal\social_embed

Hierarchy

Expanded class hierarchy of SocialEmbedConfigOverride

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

File

modules/social_features/social_embed/src/SocialEmbedConfigOverride.php, line 14

Namespace

Drupal\social_embed
View source
class SocialEmbedConfigOverride implements ConfigFactoryOverrideInterface {

  /**
   * {@inheritdoc}
   */
  public function loadOverrides($names) {
    $overrides = [];
    $config_names = [
      'filter.format.basic_html',
      'filter.format.full_html',
    ];
    foreach ($config_names as $config_name) {
      if (in_array($config_name, $names)) {

        /* @var \Drupal\Core\Config\ConfigFactory $config */
        $config = \Drupal::service('config.factory')
          ->getEditable($config_name);
        $dependencies = $config
          ->get('dependencies.module');
        $dependencies[] = 'url_embed';
        $filters = $config
          ->get('filters');
        $filters['url_embed'] = [
          'id' => 'url_embed',
          'provider' => 'url_embed',
          'status' => TRUE,
          'weight' => 100,
          'settings' => [],
        ];
        if ($config_name === 'filter.format.basic_html') {
          $filters['social_embed_convert_url'] = [
            'id' => 'social_embed_convert_url',
            'provider' => 'social_embed',
            'status' => TRUE,
            'weight' => isset($filters['filter_url']['weight']) ? $filters['filter_url']['weight'] - 1 : $filters['url_embed']['weight'] - 1,
            'settings' => [
              'url_prefix' => '',
            ],
          ];
          if (isset($filters['filter_html'])) {
            $filters['filter_html']['settings']['allowed_html'] .= ' <drupal-url data-*>';
          }
        }
        $overrides[$config_name] = [
          'dependencies' => [
            'module' => $dependencies,
          ],
          'filters' => $filters,
        ];
      }
    }
    return $overrides;
  }

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

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