Tidied base fields

This commit is contained in:
naomi 2018-05-07 19:54:30 +02:00
parent 1786fce0e8
commit f770659cef

View File

@ -227,12 +227,11 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
->setDisplayOptions('view', [ ->setDisplayOptions('view', [
'label' => 'inline', 'label' => 'inline',
'type' => 'author', 'type' => 'author',
'weight' => -3, 'weight' => -4,
]); ]);
$fields['name'] = BaseFieldDefinition::create('string') $fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name')) ->setLabel(t('Subject'))
->setDescription(t('The name of the Activity entity.'))
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setSettings([ ->setSettings([
'max_length' => 50, 'max_length' => 50,
@ -240,13 +239,13 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
]) ])
->setDefaultValue('') ->setDefaultValue('')
->setDisplayOptions('view', [ ->setDisplayOptions('view', [
'label' => 'above', 'label' => 'hidden',
'type' => 'string', 'type' => 'string',
'weight' => -2, 'weight' => -3,
]) ])
->setDisplayOptions('form', [ ->setDisplayOptions('form', [
'type' => 'string_textfield', 'type' => 'string_textfield',
'weight' => -2, 'weight' => -3,
]) ])
->setRequired(TRUE); ->setRequired(TRUE);
@ -257,23 +256,32 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
->setSetting('handler', 'default') ->setSetting('handler', 'default')
->setTranslatable(TRUE) ->setTranslatable(TRUE)
->setCardinality(1) ->setCardinality(1)
->setDisplayOptions('form', [ ->setDisplayOptions('view', [
'type' => 'entity_reference_autocomplete',
'weight' => -1,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
],
])
->setDisplayOptions('form', [
'label' => 'above', 'label' => 'above',
'weight' => -1 'weight' => -2
]) ])
->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::defaultVal') ->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::defaultVal')
->setRequired(TRUE); ->setRequired(TRUE);
$fields['description'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Description'))
->setRevisionable(TRUE)
->setSettings([
'max_length' => 50,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'basic_string',
'weight' => -1,
])
->setDisplayOptions('form', [
'type' => 'string_textarea',
'weight' => -1,
])
->setRequired(FALSE);
$fields['created'] = BaseFieldDefinition::create('created') $fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created')) ->setLabel(t('Created'))
->setDescription(t('The time that the entity was created.')); ->setDescription(t('The time that the entity was created.'));