public function ProfileLabelSubscriber::overrideProfileLabel in Open Social 8.3
Same name and namespace in other branches
- 8.9 modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 8 modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 8.2 modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 8.4 modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 8.5 modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 8.6 modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 8.7 modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 8.8 modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 10.3.x modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 10.0.x modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 10.1.x modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
- 10.2.x modules/social_features/social_profile/src/EventSubscriber/ProfileLabelSubscriber.php \Drupal\social_profile\EventSubscriber\ProfileLabelSubscriber::overrideProfileLabel()
Subscriber Callback for the event.
Parameters
\Drupal\profile\Event\ProfileLabelEvent $event: The event.
File
- modules/
social_features/ social_profile/ src/ EventSubscriber/ ProfileLabelSubscriber.php, line 35
Class
- ProfileLabelSubscriber
- Class ProfileLabelSubscriber.
Namespace
Drupal\social_profile\EventSubscriberCode
public function overrideProfileLabel(ProfileLabelEvent $event) {
$profile = $event
->getProfile();
if ($profile instanceof Profile) {
$account = User::load($profile
->getOwnerId());
if ($account instanceof User) {
$label = t('Profile of @name', [
'@name' => $account
->getDisplayName(),
]);
$event
->setLabel($label);
}
}
}