Skip to content

Commit

Permalink
Issue #3373122 by SV: Disable lazyload for message_user_profile_previ…
Browse files Browse the repository at this point in the history
…ew template
  • Loading branch information
volodymyr-sydor authored and ribel committed Jul 18, 2023
1 parent 0be8f0e commit dceea49
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ function social_activity_theme($existing, $type, $theme, $path) {
'profile_name' => '',
'profile_home' => '',
'profile_image' => '',
'profile_class' => '',
'profile_function' => '',
'profile_organization' => '',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ services:
- '@entity_type.manager'
- '@date.formatter'
- '@social_group.group_statistics'
- '@module_handler'
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Drupal\comment\Entity\Comment;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
Expand Down Expand Up @@ -47,6 +48,11 @@ class EmailTokenServices {
*/
protected GroupStatistics $groupStatistics;

/**
* The module handler.
*/
protected ModuleHandlerInterface $moduleHandler;

/**
* Constructs a EmailTokenServices object.
*
Expand All @@ -56,15 +62,19 @@ class EmailTokenServices {
* DateFormatter object.
* @param \Drupal\social_group\GroupStatistics $group_statistics
* GroupStatistics object.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler service.
*/
public function __construct(
EntityTypeManagerInterface $entity_type_manager,
DateFormatter $date_formatter,
GroupStatistics $group_statistics
GroupStatistics $group_statistics,
ModuleHandlerInterface $module_handler
) {
$this->entityTypeManager = $entity_type_manager;
$this->dateFormatter = $date_formatter;
$this->groupStatistics = $group_statistics;
$this->moduleHandler = $module_handler;
}

/**
Expand Down Expand Up @@ -218,6 +228,7 @@ public function getUserPreview(User $user) {
'#profile_name' => $user->getDisplayName(),
'#profile_home' => Url::fromRoute('entity.user.canonical', ['user' => $user->id()]),
'#profile_image' => $image_url ?? NULL,
'#profile_class' => $this->moduleHandler->moduleExists('lazy') ? 'no-lazy' : '',
'#profile_function' => $profile->getFieldValue('field_profile_function', 'value'),
'#profile_organization' => $profile->getFieldValue('field_profile_organization', 'value'),
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card__block card__block--list teaser--small">
<span class="list-item__avatar list-item__avatar--medium">
<img src="{{ profile_image }}" alt={{ "profile image"|t }}/>
<img src="{{ profile_image }}" alt={{ "profile image"|t }} class="{{ profile_class }}" />
</span>
<span class="list-item__text">
<span class="teaser--small__title">
Expand Down

0 comments on commit dceea49

Please sign in to comment.