Skip to content
Snippets Groups Projects
Commit 9238598f authored by Navneet Singh's avatar Navneet Singh Committed by Navneet Singh
Browse files

Merge pull request #2631 from goalgorilla/issue-3252050-fix-exporting-null-values

Issue #3252050 by nkoporec: Ajax error when exporting event enrollments
parent 7fc7f457
No related branches found
No related tags found
No related merge requests found
event_an_enroll:
css:
content:
theme:
css/event_an_enroll.css: {}
......@@ -352,20 +352,22 @@ class SocialEventManagersViewsBulkOperationsBulkForm extends ViewsBulkOperations
/** @var \Drupal\profile\Entity\ProfileInterface $profile */
$profile = reset($profiles);
// It must be a Guest so we pick the name values we can get.
// 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;
if (!empty($first_name = $entity->get('field_first_name')->getValue())
&& !empty($first_name[0]['value'])
) {
$name .= $first_name[0]['value'];
$name .= ' ';
}
if (!empty($last_name)) {
$name .= $last_name;
if (!empty($last_name = $entity->get('field_last_name')->getValue())
&& !empty($last_name[0]['value'])
) {
$name .= $last_name[0]['value'];
}
return $name;
return trim($name);
}
/** @var \Drupal\Core\StringTranslation\TranslatableMarkup $label */
......
......@@ -156,7 +156,7 @@ abstract class UserExportPluginBase extends PluginBase implements UserExportPlug
}
try {
$value = $user_profile->get($field_name)->value;
$value = $user_profile->get($field_name)->value ?? '';
}
catch (\Exception $e) {
$value = '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment