made org fields configurable

This commit is contained in:
Nick 2022-04-15 16:41:59 +02:00
parent 55f34cb4d7
commit 8c3f2bcbc3

View File

@ -204,19 +204,12 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
$fields['notes'] = BaseFieldDefinition::create('string_long') $fields['notes'] = BaseFieldDefinition::create('string_long')
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setLabel(t('Notes')) ->setLabel(t('Notes'))
->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true)
->setSettings(array( ->setSettings(array(
'default_value' => '', 'default_value' => '',
'max_length' => 255, 'max_length' => 255,
'text_processing' => 0, 'text_processing' => 0,
))
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'basic_string',
'weight' => 50,
))
->setDisplayOptions('form', array(
'type' => 'string_textarea',
'weight' => 50,
)); ));
$fields['website'] = BaseFieldDefinition::create('string') $fields['website'] = BaseFieldDefinition::create('string')
->setLabel(t('Website')) ->setLabel(t('Website'))
@ -226,15 +219,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'text_processing' => 0, 'text_processing' => 0,
]) ])
->setDefaultValue('') ->setDefaultValue('')
->setDisplayOptions('view', [ ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true)
'type' => 'string',
'weight' => 49,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => 49,
])
->setRequired(FALSE); ->setRequired(FALSE);
$fields['contact_name'] = BaseFieldDefinition::create('string') $fields['contact_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Contact Name')) ->setLabel(t('Contact Name'))
@ -245,15 +231,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'text_processing' => 0, 'text_processing' => 0,
]) ])
->setDefaultValue('') ->setDefaultValue('')
->setDisplayOptions('view', [ ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true)
'type' => 'string',
'weight' => 51,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => 51,
])
->setRequired(FALSE); ->setRequired(FALSE);
$fields['contact_role'] = BaseFieldDefinition::create('string') $fields['contact_role'] = BaseFieldDefinition::create('string')
@ -265,15 +244,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'text_processing' => 0, 'text_processing' => 0,
]) ])
->setDefaultValue('') ->setDefaultValue('')
->setDisplayOptions('view', [ ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true)
'type' => 'string',
'weight' => 52,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => 52,
])
->setRequired(FALSE); ->setRequired(FALSE);
$fields['email'] = BaseFieldDefinition::create('string') $fields['email'] = BaseFieldDefinition::create('string')
->setLabel(t('Email Address')) ->setLabel(t('Email Address'))
@ -283,15 +255,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'max_length' => 100, 'max_length' => 100,
'text_processing' => 0, 'text_processing' => 0,
)) ))
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'string',
'weight' => 52,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => 52,
));
$fields['phone'] = BaseFieldDefinition::create('string') $fields['phone'] = BaseFieldDefinition::create('string')
->setLabel(t('Phone Number')) ->setLabel(t('Phone Number'))
@ -301,15 +266,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'max_length' => 20, 'max_length' => 20,
'text_processing' => 0, 'text_processing' => 0,
)) ))
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'string',
'weight' => 53,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => 53,
));
$fields['postal_address'] = BaseFieldDefinition::create('string_long') $fields['postal_address'] = BaseFieldDefinition::create('string_long')
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setLabel(t('Postal Address')) ->setLabel(t('Postal Address'))
@ -319,15 +277,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'max_length' => 255, 'max_length' => 255,
'text_processing' => 0, 'text_processing' => 0,
)) ))
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'basic_string',
'weight' => 54,
))
->setDisplayOptions('form', array(
'type' => 'string_textarea',
'weight' => 54,
));
$fields['post_code'] = BaseFieldDefinition::create('string') $fields['post_code'] = BaseFieldDefinition::create('string')
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setLabel(t('Post Code')) ->setLabel(t('Post Code'))
@ -336,15 +287,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'max_length' => 10, 'max_length' => 10,
'text_processing' => 0, 'text_processing' => 0,
)) ))
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'string',
'weight' => 55,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => 55,
));
$fields['billing_contact_name'] = BaseFieldDefinition::create('string') $fields['billing_contact_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Billing Contact Name')) ->setLabel(t('Billing Contact Name'))
->setDescription(t('Name of the main contact for this client.')) ->setDescription(t('Name of the main contact for this client.'))
@ -354,15 +298,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'text_processing' => 0, 'text_processing' => 0,
]) ])
->setDefaultValue('') ->setDefaultValue('')
->setDisplayOptions('view', [ ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true)
'type' => 'string',
'weight' => 56,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => 56,
])
->setRequired(FALSE); ->setRequired(FALSE);
$fields['billing_email'] = BaseFieldDefinition::create('string') $fields['billing_email'] = BaseFieldDefinition::create('string')
@ -373,15 +310,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'max_length' => 100, 'max_length' => 100,
'text_processing' => 0, 'text_processing' => 0,
)) ))
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'string',
'weight' => 57,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => 57,
));
$fields['billing_phone'] = BaseFieldDefinition::create('string') $fields['billing_phone'] = BaseFieldDefinition::create('string')
->setLabel(t('Billing Phone Number')) ->setLabel(t('Billing Phone Number'))
@ -391,15 +321,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'max_length' => 20, 'max_length' => 20,
'text_processing' => 0, 'text_processing' => 0,
)) ))
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'string',
'weight' => 58,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => 58,
));
$fields['billing_postal_address'] = BaseFieldDefinition::create('string_long') $fields['billing_postal_address'] = BaseFieldDefinition::create('string_long')
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setLabel(t('Billing Postal Address')) ->setLabel(t('Billing Postal Address'))
@ -409,15 +332,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'max_length' => 255, 'max_length' => 255,
'text_processing' => 0, 'text_processing' => 0,
)) ))
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'basic_string',
'weight' => 59,
))
->setDisplayOptions('form', array(
'type' => 'string_textarea',
'weight' => 59,
));
$fields['billing_post_code'] = BaseFieldDefinition::create('string') $fields['billing_post_code'] = BaseFieldDefinition::create('string')
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setLabel(t('Billing Post Code')) ->setLabel(t('Billing Post Code'))
@ -426,15 +342,8 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'max_length' => 10, 'max_length' => 10,
'text_processing' => 0, 'text_processing' => 0,
)) ))
->setDisplayOptions('view', array( ->setDisplayConfigurable('form', true)
'label' => 'above', ->setDisplayConfigurable('view', true);
'type' => 'string',
'weight' => 60,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => 60,
));
$fields['user_id'] = BaseFieldDefinition::create('entity_reference') $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Added by')) ->setLabel(t('Added by'))
->setRevisionable(TRUE) ->setRevisionable(TRUE)
@ -450,24 +359,16 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
'text_processing' => 0, 'text_processing' => 0,
]) ])
->setDefaultValue('') ->setDefaultValue('')
->setDisplayOptions('view', [ ->setDisplayConfigurable('form', true)
'label' => 'hidden', ->setDisplayConfigurable('view', true)
'type' => 'string',
'weight' => -100,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -100,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE); ->setRequired(TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean') $fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Visible')) ->setLabel(t('Visible'))
->setDescription('If this box is not ticked this record will be hidden from view for most users. Users with access to unpublished entities will be able to restore it if needed.') ->setDescription('If this box is not ticked this record will be hidden from view for most users. Users with access to unpublished entities will be able to restore it if needed.')
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setDisplayConfigurable("form", true) ->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true)
->setDefaultValue(TRUE); ->setDefaultValue(TRUE);