function easy_email_field_add_bcc_address_field in Easy Email 8
Same name and namespace in other branches
- 2.0.x easy_email.module \easy_email_field_add_bcc_address_field()
1 call to easy_email_field_add_bcc_address_field()
File
- ./
easy_email.module, line 529 - Contains easy_email.module.
Code
function easy_email_field_add_bcc_address_field(EasyEmailTypeInterface $easy_email_type) {
$field_definition = BaseFieldDefinition::create('string')
->setTargetEntityTypeId('easy_email')
->setTargetBundle($easy_email_type
->id())
->setName('bcc_address')
->setLabel(t('BCC Addresses'))
->setDescription(t('The BCC email addresses of the Email entity.'))
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setRevisionable(TRUE)
->setSettings([
'max_length' => 255,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -4,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -4,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
try {
easy_email_create_field($field_definition, FALSE);
} catch (\RuntimeException $e) {
// In this case, field already exists from installation
} catch (EntityStorageException $e) {
// In this case, field already exists from installation
}
}