Removed full name field, thus fixing name-not-changing bug

This commit is contained in:
autonomic 2022-03-17 10:52:40 +01:00
parent cc551b0851
commit 57fae7c1c3

View File

@ -119,14 +119,9 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
$translation->setOwnerId(0);
}
}
if ($this->get('full_name')->value) {
$name = $this->get('full_name')->value . ' ';
} else {
$name = $this->get('first_name')->value . ' ';
if ($this->get('middle_names')->value) $name .= $this->get('middle_names')->value . ' ';
$name .= $this->get('last_name')->value . ' ';
}
$name = $this->get('first_name')->value . ' ';
if ($this->get('middle_names')->value) $name .= $this->get('middle_names')->value . ' ';
$name .= $this->get('last_name')->value . ' ';
$this->setName($name);
@ -241,24 +236,6 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
->setSetting('handler', 'default')
->setTranslatable(TRUE);
// When configuring a person type, you will need to choose whether to have full name or first and last name fields displayed.
$fields['full_name'] = BaseFieldDefinition::create('string')
->setDescription(t('The person\'s name.'))
->setLabel(t('Name'))
->setRevisionable(TRUE)
->setSettings([
'max_length' => 100,
'text_processing' => 0,
])
->setDisplayConfigurable("form", true)
->setDisplayConfigurable("view", true)
->setDefaultValue('')
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -50,
])
->setRequired(TRUE);
$fields['first_name'] = BaseFieldDefinition::create('string')
->setLabel(t('First Name'))
->setDescription(t("The person's first name."))