You are here

public function SocialEmbedConfigOverride::loadOverrides in Open Social 8

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

Returns config overrides.

Parameters

array $names: A list of configuration names that are being loaded.

Return value

array An array keyed by configuration name of override data. Override data contains a nested array structure of overrides.

Overrides ConfigFactoryOverrideInterface::loadOverrides

File

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

Class

SocialEmbedConfigOverride
Class SocialEmbedConfigOverride.

Namespace

Drupal\social_embed

Code

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;
}