public function SocialLazyLoadingImageDisplayOverride::loadOverrides in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/custom/social_lazy_loading/social_lazy_loading_images/src/SocialLazyLoadingImageDisplayOverride.php \Drupal\social_lazy_loading_images\SocialLazyLoadingImageDisplayOverride::loadOverrides()
- 8.6 modules/custom/social_lazy_loading/social_lazy_loading_images/src/SocialLazyLoadingImageDisplayOverride.php \Drupal\social_lazy_loading_images\SocialLazyLoadingImageDisplayOverride::loadOverrides()
- 8.7 modules/custom/social_lazy_loading/social_lazy_loading_images/src/SocialLazyLoadingImageDisplayOverride.php \Drupal\social_lazy_loading_images\SocialLazyLoadingImageDisplayOverride::loadOverrides()
- 10.3.x modules/custom/social_lazy_loading/social_lazy_loading_images/src/SocialLazyLoadingImageDisplayOverride.php \Drupal\social_lazy_loading_images\SocialLazyLoadingImageDisplayOverride::loadOverrides()
- 10.0.x modules/custom/social_lazy_loading/social_lazy_loading_images/src/SocialLazyLoadingImageDisplayOverride.php \Drupal\social_lazy_loading_images\SocialLazyLoadingImageDisplayOverride::loadOverrides()
- 10.1.x modules/custom/social_lazy_loading/social_lazy_loading_images/src/SocialLazyLoadingImageDisplayOverride.php \Drupal\social_lazy_loading_images\SocialLazyLoadingImageDisplayOverride::loadOverrides()
- 10.2.x modules/custom/social_lazy_loading/social_lazy_loading_images/src/SocialLazyLoadingImageDisplayOverride.php \Drupal\social_lazy_loading_images\SocialLazyLoadingImageDisplayOverride::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/ social_lazy_loading_images/ src/ SocialLazyLoadingImageDisplayOverride.php, line 19
Class
- SocialLazyLoadingImageDisplayOverride
- Class SocialLazyLoadingTextFormatOverride.
Namespace
Drupal\social_lazy_loading_imagesCode
public function loadOverrides($names) {
$overrides = [];
$config_fields = [
// Event.
'core.entity_view_display.node.event.teaser' => 'field_event_image',
'core.entity_view_display.node.event.hero' => 'field_event_image',
'core.entity_view_display.node.event.activity' => 'field_event_image',
'core.entity_view_display.node.event.activity_comment' => 'field_event_image',
// Topic.
'core.entity_view_display.node.topic.teaser' => 'field_topic_image',
'core.entity_view_display.node.topic.activity' => 'field_topic_image',
'core.entity_view_display.node.topic.activity_comment' => 'field_topic_image',
// Page.
'core.entity_view_display.node.page.teaser' => 'field_page_image',
'core.entity_view_display.node.page.activity' => 'field_page_image',
'core.entity_view_display.node.page.activity_comment' => 'field_page_image',
// Groups.
'core.entity_view_display.group.open_group.teaser' => 'field_group_image',
'core.entity_view_display.group.open_group.hero' => 'field_group_image',
'core.entity_view_display.group.secret_group.teaser' => 'field_group_image',
'core.entity_view_display.group.secret_group.hero' => 'field_group_image',
'core.entity_view_display.group.flexible_group.teaser' => 'field_group_image',
'core.entity_view_display.group.flexible_group.hero' => 'field_group_image',
'core.entity_view_display.group.public_group.teaser' => 'field_group_image',
'core.entity_view_display.group.public_group.hero' => 'field_group_image',
'core.entity_view_display.group.closed_group.teaser' => 'field_group_image',
'core.entity_view_display.group.closed_group.hero' => 'field_group_image',
// Posts.
'core.entity_view_display.post.photo.activity' => 'field_post_image',
'core.entity_view_display.post.photo.activity_comment' => 'field_post_image',
'core.entity_view_display.post.photo.default' => 'field_post_image',
// Books.
'core.entity_view_display.node.book.teaser' => 'field_book_image',
'core.entity_view_display.node.book.activity' => 'field_book_image',
'core.entity_view_display.node.book.activity_comment' => 'field_book_image',
// Profile.
'core.entity_view_display.profile.profile.compact' => 'field_profile_image',
'core.entity_view_display.profile.profile.compact_notification' => 'field_profile_image',
'core.entity_view_display.profile.profile.compact_teaser' => 'field_profile_image',
'core.entity_view_display.profile.profile.hero' => 'field_profile_image',
'core.entity_view_display.profile.profile.small' => 'field_profile_image',
'core.entity_view_display.profile.profile.small_teaser' => 'field_profile_image',
'core.entity_view_display.profile.profile.table' => 'field_profile_image',
'core.entity_view_display.profile.profile.teaser' => 'field_profile_image',
];
foreach ($config_fields as $config_name => $field_name) {
if (in_array($config_name, $names)) {
$overrides[$config_name]['dependencies']['module']['lazy'] = 'lazy';
$overrides[$config_name]['content'][$field_name]['third_party_settings']['lazy'] = [
'lazy_image' => '1',
];
}
}
return $overrides;
}