Skip to content

Commit

Permalink
NBBIB-307 Add entity type check to nbbib_core::update_names() function
Browse files Browse the repository at this point in the history
  • Loading branch information
camilocodes committed Jul 11, 2023
1 parent c89922d commit b820618
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions custom/modules/nbbib_core/nbbib_core.module
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}

/**
Expand Down

0 comments on commit b820618

Please sign in to comment.