Skip to content
Snippets Groups Projects
Commit 8f0b2a39 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 de9a5f59
No related branches found
No related tags found
No related merge requests found
event_an_enroll: event_an_enroll:
css: css:
content: theme:
css/event_an_enroll.css: {} css/event_an_enroll.css: {}
...@@ -352,20 +352,22 @@ class SocialEventManagersViewsBulkOperationsBulkForm extends ViewsBulkOperations ...@@ -352,20 +352,22 @@ class SocialEventManagersViewsBulkOperationsBulkForm extends ViewsBulkOperations
/** @var \Drupal\profile\Entity\ProfileInterface $profile */ /** @var \Drupal\profile\Entity\ProfileInterface $profile */
$profile = reset($profiles); $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) { if (!$profile) {
$name = ''; $name = '';
$first_name = $entity->get('field_first_name')->getValue()[0]['value']; if (!empty($first_name = $entity->get('field_first_name')->getValue())
$last_name = $entity->get('field_last_name')->getValue()[0]['value']; && !empty($first_name[0]['value'])
if (!empty($first_name)) { ) {
$name .= $first_name; $name .= $first_name[0]['value'];
$name .= ' '; $name .= ' ';
} }
if (!empty($last_name)) { if (!empty($last_name = $entity->get('field_last_name')->getValue())
$name .= $last_name; && !empty($last_name[0]['value'])
) {
$name .= $last_name[0]['value'];
} }
return $name; return trim($name);
} }
/** @var \Drupal\Core\StringTranslation\TranslatableMarkup $label */ /** @var \Drupal\Core\StringTranslation\TranslatableMarkup $label */
......
...@@ -156,7 +156,7 @@ abstract class UserExportPluginBase extends PluginBase implements UserExportPlug ...@@ -156,7 +156,7 @@ abstract class UserExportPluginBase extends PluginBase implements UserExportPlug
} }
try { try {
$value = $user_profile->get($field_name)->value; $value = $user_profile->get($field_name)->value ?? '';
} }
catch (\Exception $e) { catch (\Exception $e) {
$value = ''; $value = '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment