public static function MailchimpCampaign::baseFieldDefinitions in Mailchimp 8
Same name and namespace in other branches
- 2.x modules/mailchimp_campaign/src/Entity/MailchimpCampaign.php \Drupal\mailchimp_campaign\Entity\MailchimpCampaign::baseFieldDefinitions()
Define the field properties here.
Field name, type and size determine the table structure.
In addition, we can define how the field and its content can be manipulated in the GUI. The behaviour of the widgets used can be determined here.
Overrides ContentEntityBase::baseFieldDefinitions
File
- modules/
mailchimp_campaign/ src/ Entity/ MailchimpCampaign.php, line 91
Class
- MailchimpCampaign
- Defines the MailchimpCampaign entity.
Namespace
Drupal\mailchimp_campaign\EntityCode
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = [];
// Standard field, used as unique if primary index.
$fields['mc_campaign_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Mailchimp Campaign ID'))
->setDescription(t('Mailchimp campaign ID.'))
->setSetting('max_length', 16);
// Standard field, unique outside of the scope of the current project.
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The UUID of the campaign.'))
->setReadOnly(TRUE);
$fields['template'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Template'))
->setDescription(t('Campaign body template.'))
->setSetting('case_sensitive', TRUE)
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string_long',
'weight' => 0,
]);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
->setDescription(t('The Unix timestamp when the campaign was created.'));
$fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Changed'))
->setDescription(t('The Unix timestamp when the campaign was most recently saved.'));
return $fields;
}