public function SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
- 8.6 modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
- 8.7 modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
- 8.8 modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
- 10.3.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
- 10.0.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
- 10.1.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
- 10.2.x modules/social_features/social_event/modules/social_event_managers/src/Plugin/views/field/SocialEventManagersViewsBulkOperationsBulkForm.php \Drupal\social_event_managers\Plugin\views\field\SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
Returns modified entity label.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity.
Return value
string The label text.
2 calls to SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
- SocialEventAnEnrollViewsBulkOperationsBulkForm::getEntityLabel in modules/
social_features/ social_event/ modules/ social_event_an_enroll/ src/ Plugin/ views/ field/ SocialEventAnEnrollViewsBulkOperationsBulkForm.php - Returns modified entity label.
- SocialEventManagersViewsBulkOperationsBulkForm::viewsForm in modules/
social_features/ social_event/ modules/ social_event_managers/ src/ Plugin/ views/ field/ SocialEventManagersViewsBulkOperationsBulkForm.php
1 method overrides SocialEventManagersViewsBulkOperationsBulkForm::getEntityLabel()
- SocialEventAnEnrollViewsBulkOperationsBulkForm::getEntityLabel in modules/
social_features/ social_event/ modules/ social_event_an_enroll/ src/ Plugin/ views/ field/ SocialEventAnEnrollViewsBulkOperationsBulkForm.php - Returns modified entity label.
File
- modules/
social_features/ social_event/ modules/ social_event_managers/ src/ Plugin/ views/ field/ SocialEventManagersViewsBulkOperationsBulkForm.php, line 295
Class
- SocialEventManagersViewsBulkOperationsBulkForm
- Defines the Enrollments Views Bulk Operations field plugin.
Namespace
Drupal\social_event_managers\Plugin\views\fieldCode
public function getEntityLabel(EntityInterface $entity) {
$profiles = $this->entityTypeManager
->getStorage('profile')
->loadByProperties([
'uid' => $entity->field_account->target_id,
]);
/** @var \Drupal\profile\Entity\ProfileInterface $profile */
$profile = reset($profiles);
// It must be a Guest so we pick the name values we can get.
if (!$profile) {
$name = '';
$first_name = $entity
->get('field_first_name')
->getValue()[0]['value'];
$last_name = $entity
->get('field_last_name')
->getValue()[0]['value'];
if (!empty($first_name)) {
$name .= $first_name;
$name .= ' ';
}
if (!empty($last_name)) {
$name .= $last_name;
}
return $name;
}
/** @var \Drupal\Core\StringTranslation\TranslatableMarkup $label */
$label = $profile
->label();
return $label
->getArguments()['@name'];
}