Skip to content

Commit

Permalink
Add separate table for Domain Email Addresses
Browse files Browse the repository at this point in the history
Introduce a new entity type `DomainEmailAddress` as an alternative
to the 'from_email_address' option group.
  • Loading branch information
colemanw committed Jan 29, 2025
1 parent 248ca18 commit 1c5672a
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions schema/Core/DomainEmailAddress.entityType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

return [
'name' => 'DomainEmailAddress',
'table' => 'civicrm_domain_email_address',
'class' => 'CRM_Core_DAO_DomainEmailAddress',
'getInfo' => fn() => [
'title' => ts('Site Email Address'),
'title_plural' => ts('Site Email Addresses'),
'description' => ts('Return addresses to use for system-generated emails.'),
'log' => TRUE,
'add' => '6.0',
'icon' => 'fa-envelope',
'label_field' => 'display_name',
'search_fields' => ['display_name', 'email'],
],
'getPaths' => fn() => [],
'getIndices' => fn() => [
'UI_domain_id_is_default' => [
'fields' => [
'domain_id' => TRUE,
'is_default' => TRUE,
],
'unique' => TRUE,
'add' => '6.0',
],
],
'getFields' => fn() => [
'id' => [
'title' => ts('ID'),
'sql_type' => 'int unsigned',
'input_type' => 'Number',
'required' => TRUE,
'description' => ts('Email Address ID'),
'add' => '6.0',
'primary_key' => TRUE,
'auto_increment' => TRUE,
],
'display_name' => [
'title' => ts('Display Name'),
'sql_type' => 'varchar(63)',
'input_type' => 'Text',
'required' => TRUE,
'description' => ts('First and last name of the recipient.'),
'add' => '6.0',
],
'email' => [
'title' => ts('Email'),
'sql_type' => 'varchar(254)',
'input_type' => 'Email',
'description' => ts('Email address'),
'add' => '6.0',
'input_attrs' => [
'size' => '30',
],
],
'is_default' => [
'title' => ts('Default'),
'sql_type' => 'boolean',
'input_type' => 'CheckBox',
'description' => ts('Is this the default email for this domain?'),
'add' => '6.0',
'default' => FALSE,
'input_attrs' => [
'label' => ts('Default'),
],
],
'description' => [
'title' => ts('Description'),
'sql_type' => 'text',
'input_type' => 'TextArea',
'description' => ts('Purpose of this email address.'),
'add' => '6.0',
'input_attrs' => [
'rows' => 4,
'cols' => 60,
],
],
'is_active' => [
'title' => ts('Enabled'),
'sql_type' => 'boolean',
'input_type' => 'CheckBox',
'description' => ts('Is this email address enabled?'),
'add' => '6.0',
'default' => TRUE,
'input_attrs' => [
'label' => ts('Enabled'),
],
],
'domain_id' => [
'title' => ts('Domain ID'),
'sql_type' => 'int unsigned',
'input_type' => 'EntityRef',
'description' => ts('Which Domain is this option value for'),
'add' => '6.0',
'input_attrs' => [
'label' => ts('Domain'),
],
'pseudoconstant' => [
'table' => 'civicrm_domain',
'key_column' => 'id',
'label_column' => 'name',
],
'entity_reference' => [
'entity' => 'Domain',
'key' => 'id',
],
],
],
];

0 comments on commit 1c5672a

Please sign in to comment.