From b8206186af64655af8b4b2f7c45c6766c3280d71 Mon Sep 17 00:00:00 2001 From: Camilo Villamizar Date: Tue, 11 Jul 2023 16:25:11 -0300 Subject: [PATCH] NBBIB-307 Add entity type check to nbbib_core::update_names() function --- custom/modules/nbbib_core/nbbib_core.module | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/custom/modules/nbbib_core/nbbib_core.module b/custom/modules/nbbib_core/nbbib_core.module index 52470e91..349852fa 100644 --- a/custom/modules/nbbib_core/nbbib_core.module +++ b/custom/modules/nbbib_core/nbbib_core.module @@ -517,12 +517,14 @@ function nbbib_core_inline_entity_form_entity_form_alter(&$entity_form, FormStat * Update display and sort names on contributor IEF collapse. */ function update_names($entity_type, $entity, $entity_form, &$form_state) { - $first_name = $entity->getFirstName(); - $last_name = $entity->getLastName(); - $institution_name = $entity->getInstitutionName(); - $names = generate_names($first_name, $last_name, $institution_name); - $entity->setName($names['name']); - $entity->setSortName($names['sort_name']); + if ($entity_type == "yabrm_contributor") { + $first_name = $entity->getFirstName(); + $last_name = $entity->getLastName(); + $institution_name = $entity->getInstitutionName(); + $names = generate_names($first_name, $last_name, $institution_name); + $entity->setName($names['name']); + $entity->setSortName($names['sort_name']); + } } /**