made EqualOpps fields configurable

This commit is contained in:
Nick 2022-04-15 16:48:34 +02:00
parent aa6d580d62
commit 2f06caa261

View File

@ -112,7 +112,9 @@ class OCEqualOpps extends ContentEntityBase implements OCEqualOppsInterface {
->setSettings([ ->setSettings([
'max_length' => 50, 'max_length' => 50,
'text_processing' => 0, 'text_processing' => 0,
]); ])
->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true);
$fields['oc_actor'] = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference') $fields['oc_actor'] = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference')
->setLabel(t('Person')) ->setLabel(t('Person'))
@ -120,14 +122,8 @@ class OCEqualOpps extends ContentEntityBase implements OCEqualOppsInterface {
->setSetting('target_type', 'oc_actor') ->setSetting('target_type', 'oc_actor')
->setSetting('handler', 'default') ->setSetting('handler', 'default')
->setCardinality(1) ->setCardinality(1)
->setDisplayOptions('view', [ ->setDisplayConfigurable('form', true)
'type' => 'string', ->setDisplayConfigurable('view', true)
'weight' => -100,
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete_tags',
'weight' => -100,
])
->setRequired(TRUE); ->setRequired(TRUE);
$fields['age'] = BaseFieldDefinition::create('list_string') $fields['age'] = BaseFieldDefinition::create('list_string')
@ -144,27 +140,13 @@ class OCEqualOpps extends ContentEntityBase implements OCEqualOppsInterface {
], ],
]) ])
->setDisplayConfigurable('form', true) ->setDisplayConfigurable('form', true)
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'string',
'weight' => -5,
))
->setDisplayOptions('form', array(
'type' => 'options_select',
'weight' => -5,
));
$fields['access_needs'] = BaseFieldDefinition::create('string_long') $fields['access_needs'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Access Needs')) ->setLabel(t('Access Needs'))
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_long',
'weight' => -4,
));
$fields['gender'] = BaseFieldDefinition::create('list_string') $fields['gender'] = BaseFieldDefinition::create('list_string')
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setLabel(t('Gender')) ->setLabel(t('Gender'))
@ -180,15 +162,7 @@ class OCEqualOpps extends ContentEntityBase implements OCEqualOppsInterface {
], ],
]) ])
->setDisplayConfigurable('form', true) ->setDisplayConfigurable('form', true)
->setDisplayOptions('view', array( ->setDisplayConfigurable('view', true);
'label' => 'above',
'type' => 'string',
'weight' => -5,
))
->setDisplayOptions('form', array(
'type' => 'options_select',
'weight' => -5,
));
$fields['race_ethnicity'] = BaseFieldDefinition::create('list_string') $fields['race_ethnicity'] = BaseFieldDefinition::create('list_string')
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setLabel(t('Race/Ethnicity')) ->setLabel(t('Race/Ethnicity'))
@ -215,15 +189,7 @@ class OCEqualOpps extends ContentEntityBase implements OCEqualOppsInterface {
], ],
]) ])
->setDisplayConfigurable('form', true) ->setDisplayConfigurable('form', true)
->setDisplayOptions('view', array( ->setDisplayConfigurable('view', true);
'label' => 'above',
'type' => 'string',
'weight' => -5,
))
->setDisplayOptions('form', array(
'type' => 'options_select',
'weight' => -5,
));
$fields['sexuality'] = BaseFieldDefinition::create('string') $fields['sexuality'] = BaseFieldDefinition::create('string')
->setLabel(t('Sexuality')) ->setLabel(t('Sexuality'))
->setRevisionable(TRUE) ->setRevisionable(TRUE)
@ -231,18 +197,9 @@ class OCEqualOpps extends ContentEntityBase implements OCEqualOppsInterface {
'max_length' => 20, 'max_length' => 20,
'text_processing' => 0, 'text_processing' => 0,
]) ])
->setDisplayConfigurable("form", true)
->setDisplayConfigurable("view", true)
->setDefaultValue('') ->setDefaultValue('')
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'string',
'weight' => -1,
))
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -1,
]);
$fields['status']->setDescription(t('A boolean indicating whether the Equal Opps is published.')); $fields['status']->setDescription(t('A boolean indicating whether the Equal Opps is published.'));