Wiring up new Organisation entity type
This commit is contained in:
@ -194,6 +194,203 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
|
||||
// Add the published field.
|
||||
$fields += static::publishedBaseFieldDefinitions($entity_type);
|
||||
|
||||
$fields['notes'] = BaseFieldDefinition::create('string_long')
|
||||
->setRevisionable(TRUE)
|
||||
->setLabel(t('Notes'))
|
||||
->setSettings(array(
|
||||
'default_value' => '',
|
||||
'max_length' => 255,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'basic_string',
|
||||
'weight' => -10,
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'string_textarea',
|
||||
'weight' => -10,
|
||||
));
|
||||
$fields['contact_name'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Contact Name'))
|
||||
->setDescription(t('Name of the main contact for this client.'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings([
|
||||
'max_length' => 50,
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => -8,
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -8,
|
||||
])
|
||||
->setRequired(FALSE);
|
||||
|
||||
$fields['email'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Email Address'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings(array(
|
||||
'default_value' => '',
|
||||
'max_length' => 30,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => -8,
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -8,
|
||||
));
|
||||
|
||||
$fields['phone'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Phone Number'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings(array(
|
||||
'default_value' => '',
|
||||
'max_length' => 20,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => -7,
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -7,
|
||||
));
|
||||
$fields['postal_address'] = BaseFieldDefinition::create('string_long')
|
||||
->setRevisionable(TRUE)
|
||||
->setLabel(t('Postal Address'))
|
||||
->setDescription(t('Full address, apart from post code.'))
|
||||
->setSettings(array(
|
||||
'default_value' => '',
|
||||
'max_length' => 255,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'basic_string',
|
||||
'weight' => -5,
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'string_textarea',
|
||||
'weight' => -5,
|
||||
));
|
||||
$fields['post_code'] = BaseFieldDefinition::create('string')
|
||||
->setRevisionable(TRUE)
|
||||
->setLabel(t('Post Code'))
|
||||
->setSettings(array(
|
||||
'default_value' => '',
|
||||
'max_length' => 10,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => -4,
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -4,
|
||||
));
|
||||
$fields['billing_contact_name'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Billing Contact Name'))
|
||||
->setDescription(t('Name of the main contact for this client.'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings([
|
||||
'max_length' => 50,
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => -3,
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -3,
|
||||
])
|
||||
->setRequired(FALSE);
|
||||
|
||||
$fields['billing_email'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Billing Email Address'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings(array(
|
||||
'default_value' => '',
|
||||
'max_length' => 30,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => -2,
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -2,
|
||||
));
|
||||
|
||||
$fields['billing_phone'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Billing Phone Number'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings(array(
|
||||
'default_value' => '',
|
||||
'max_length' => 20,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => -1,
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -1,
|
||||
));
|
||||
$fields['billing_postal_address'] = BaseFieldDefinition::create('string_long')
|
||||
->setRevisionable(TRUE)
|
||||
->setLabel(t('Billing Postal Address'))
|
||||
->setDescription(t('Full address, apart from post code.'))
|
||||
->setSettings(array(
|
||||
'default_value' => '',
|
||||
'max_length' => 255,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'basic_string',
|
||||
'weight' => -0,
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'string_textarea',
|
||||
'weight' => -0,
|
||||
));
|
||||
$fields['billing_post_code'] = BaseFieldDefinition::create('string')
|
||||
->setRevisionable(TRUE)
|
||||
->setLabel(t('Billing Post Code'))
|
||||
->setSettings(array(
|
||||
'default_value' => '',
|
||||
'max_length' => 10,
|
||||
'text_processing' => 0,
|
||||
))
|
||||
->setDisplayOptions('view', array(
|
||||
'label' => 'above',
|
||||
'type' => 'string',
|
||||
'weight' => 1,
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'string_textfield',
|
||||
'weight' => 1,
|
||||
));
|
||||
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Authored by'))
|
||||
->setDescription(t('The user ID of author of the Organisation entity.'))
|
||||
|
@ -31,11 +31,11 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
* "uuid" = "uuid"
|
||||
* },
|
||||
* links = {
|
||||
* "canonical" = "/opencase/oc_organisation_type/{oc_organisation_type}",
|
||||
* "add-form" = "/opencase/oc_organisation_type/add",
|
||||
* "edit-form" = "/opencase/oc_organisation_type/{oc_organisation_type}/edit",
|
||||
* "delete-form" = "/opencase/oc_organisation_type/{oc_organisation_type}/delete",
|
||||
* "collection" = "/opencase/oc_organisation_type"
|
||||
* "canonical" = "/admin/opencase/oc_organisation_type/{oc_organisation_type}",
|
||||
* "add-form" = "/admin/opencase/oc_organisation_type/add",
|
||||
* "edit-form" = "/admin/opencase/oc_organisation_type/{oc_organisation_type}/edit",
|
||||
* "delete-form" = "/admin/opencase/oc_organisation_type/{oc_organisation_type}/delete",
|
||||
* "collection" = "/admin/opencase/oc_organisation_type"
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
|
Reference in New Issue
Block a user