From 0f5fbd688e34cb3c489709741d08ed79a605517f Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 22 Aug 2022 10:53:03 +1200 Subject: [PATCH] Simplify Domain edit form to not call complete LocationBlock build --- CRM/Contact/Form/Domain.php | 20 ++++++++------------ templates/CRM/Contact/Form/Domain.tpl | 6 +++--- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/CRM/Contact/Form/Domain.php b/CRM/Contact/Form/Domain.php index 7506570680..fd938776f0 100644 --- a/CRM/Contact/Form/Domain.php +++ b/CRM/Contact/Form/Domain.php @@ -48,25 +48,17 @@ class CRM_Contact_Form_Domain extends CRM_Core_Form { */ protected $_locationDefaults = []; - /** - * How many locationBlocks should we display? - * - * @var int - * @const - */ - const LOCATION_BLOCKS = 1; - /** * Explicitly declare the entity api name. */ - public function getDefaultEntity() { + public function getDefaultEntity(): string { return 'Domain'; } /** * Explicitly declare the form context. */ - public function getDefaultContext() { + public function getDefaultContext(): string { return 'create'; } @@ -121,13 +113,17 @@ class CRM_Contact_Form_Domain extends CRM_Core_Form { /** * Build the form object. + * + * @throws \CiviCRM_API3_Exception */ - public function buildQuickForm() { + public function buildQuickForm(): void { $this->addField('name', ['label' => ts('Organization Name')], TRUE); $this->addField('description', ['label' => ts('Description'), 'size' => 30]); //build location blocks. - CRM_Contact_Form_Location::buildQuickForm($this); + CRM_Contact_Form_Edit_Address::buildQuickForm($this, 1); + CRM_Contact_Form_Edit_Email::buildQuickForm($this, 1); + CRM_Contact_Form_Edit_Phone::buildQuickForm($this, 1); $this->addButtons([ [ diff --git a/templates/CRM/Contact/Form/Domain.tpl b/templates/CRM/Contact/Form/Domain.tpl index ed1044c78f..5a1bc69c72 100644 --- a/templates/CRM/Contact/Form/Domain.tpl +++ b/templates/CRM/Contact/Form/Domain.tpl @@ -31,15 +31,15 @@

{ts}Default Organization Address{/ts}

{ts 1={domain.address}}CiviMail mailings must include the sending organization's address. This is done by putting the %1 token in either the body or footer of the mailing. This token may also be used in regular 'Email - send now' messages and in other Message Templates. The token is replaced by the address entered below when the message is sent.{/ts}
- {include file="CRM/Contact/Form/Edit/Address.tpl" masterAddress='' parseStreetAddress=''} + {include file="CRM/Contact/Form/Edit/Address.tpl" blockId=1 masterAddress='' parseStreetAddress=''}

{ts}Organization Contact Information{/ts}

{ts}You can also include general email and/or phone contact information in mailings.{/ts} {help id="additional-contact"}
{* Display the email block *} - {include file="CRM/Contact/Form/Edit/Email.tpl"} + {include file="CRM/Contact/Form/Edit/Email.tpl" blockId=1} {* Display the phone block *} - {include file="CRM/Contact/Form/Edit/Phone.tpl"} + {include file="CRM/Contact/Form/Edit/Phone.tpl" blockId=1}
-- 2.25.1