You are here

public function SocialLazyLoadingTextFormatOverride::loadOverrides in Open Social 10.0.x

Same name and namespace in other branches
  1. 8.9 modules/custom/social_lazy_loading/src/SocialLazyLoadingTextFormatOverride.php \Drupal\social_lazy_loading\SocialLazyLoadingTextFormatOverride::loadOverrides()
  2. 8.6 modules/custom/social_lazy_loading/src/SocialLazyLoadingTextFormatOverride.php \Drupal\social_lazy_loading\SocialLazyLoadingTextFormatOverride::loadOverrides()
  3. 8.7 modules/custom/social_lazy_loading/src/SocialLazyLoadingTextFormatOverride.php \Drupal\social_lazy_loading\SocialLazyLoadingTextFormatOverride::loadOverrides()
  4. 8.8 modules/custom/social_lazy_loading/src/SocialLazyLoadingTextFormatOverride.php \Drupal\social_lazy_loading\SocialLazyLoadingTextFormatOverride::loadOverrides()
  5. 10.3.x modules/custom/social_lazy_loading/src/SocialLazyLoadingTextFormatOverride.php \Drupal\social_lazy_loading\SocialLazyLoadingTextFormatOverride::loadOverrides()
  6. 10.1.x modules/custom/social_lazy_loading/src/SocialLazyLoadingTextFormatOverride.php \Drupal\social_lazy_loading\SocialLazyLoadingTextFormatOverride::loadOverrides()
  7. 10.2.x modules/custom/social_lazy_loading/src/SocialLazyLoadingTextFormatOverride.php \Drupal\social_lazy_loading\SocialLazyLoadingTextFormatOverride::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/custom/social_lazy_loading/src/SocialLazyLoadingTextFormatOverride.php, line 37

Class

SocialLazyLoadingTextFormatOverride
Class SocialLazyLoadingTextFormatOverride.

Namespace

Drupal\social_lazy_loading

Code

public function loadOverrides($names) {
  $overrides = [];
  $formats = [
    'basic_html' => TRUE,
    'full_html' => TRUE,
    'plain_text' => TRUE,
    'simple_text' => TRUE,
    'restricted_html' => TRUE,
    'mail_html' => TRUE,
  ];
  $this->moduleHandler
    ->alter('social_lazy_loading_formats', $formats);
  foreach ($formats as $format => $convert_url) {
    if (in_array('filter.format.' . $format, $names, FALSE)) {
      $this
        ->addFilterOverride($format, $convert_url, $overrides);
    }
  }

  // Set lazy loading settings.
  if (in_array('lazy.settings', $names, FALSE)) {
    $overrides['lazy.settings']['alter_tag'] = [
      'img' => 'img',
      'iframe' => 'iframe',
    ];
  }
  return $overrides;
}