Added first, middle and last name fields to actor

This commit is contained in:
naomi 2018-04-29 14:44:52 +02:00
parent 4b7f983b27
commit 76f61b16b7

View File

@ -230,7 +230,35 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
$fields['name'] = BaseFieldDefinition::create('string') $fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name')) ->setLabel(t('Name'))
->setDescription(t('The name of the Actor entity.')) ->setSettings([
'max_length' => 100,
'text_processing' => 0,
])
->setRequired(TRUE);
$fields['first_name'] = BaseFieldDefinition::create('string')
->setLabel(t('First Name'))
->setDescription(t("The person's first name."))
->setRevisionable(TRUE)
->setSettings([
'max_length' => 20,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -4,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -4,
])
->setRequired(TRUE);
$fields['middle_names'] = BaseFieldDefinition::create('string')
->setLabel(t('Middle Names'))
->setDescription(t("The person's middle names, if any."))
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setSettings([ ->setSettings([
'max_length' => 50, 'max_length' => 50,
@ -246,8 +274,26 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
'type' => 'string_textfield', 'type' => 'string_textfield',
'weight' => -4, 'weight' => -4,
]) ])
->setDisplayConfigurable('form', TRUE) ->setRequired(FALSE);
->setDisplayConfigurable('view', TRUE)
$fields['last_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Last Name'))
->setDescription(t("The person's last name"))
->setRevisionable(TRUE)
->setSettings([
'max_length' => 20,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -4,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -4,
])
->setRequired(TRUE); ->setRequired(TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean') $fields['status'] = BaseFieldDefinition::create('boolean')