SocialPostHelper.php in Open Social 10.3.x
File
modules/social_features/social_post/src/Service/SocialPostHelper.php
View source
<?php
namespace Drupal\social_post\Service;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Session\AccountProxyInterface;
class SocialPostHelper implements SocialPostHelperInterface {
protected $entityTypeManager;
protected $currentUser;
public function __construct(EntityTypeManagerInterface $entity_type_manager, AccountProxyInterface $current_user) {
$this->entityTypeManager = $entity_type_manager;
$this->currentUser = $current_user;
}
public function buildCurrentUserImage() {
$storage = $this->entityTypeManager
->getStorage('profile');
if (!empty($storage)) {
$account = $this->currentUser
->getAccount();
if ($user_profile = $storage
->loadByUser($account, 'profile')) {
return $this->entityTypeManager
->getViewBuilder('profile')
->view($user_profile, 'compact_notification');
}
}
return NULL;
}
}