From 83f6005ac53ad8ee11a1b001b3175f03697344b4 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sun, 26 Mar 2023 11:52:14 +0100 Subject: [PATCH] [REF][PHP8.2] Declare properties directly on CRM_Core_Form_EntityFormTrait --- CRM/Admin/Form/PaymentProcessor.php | 19 ----------------- CRM/Admin/Form/RelationshipType.php | 19 ----------------- CRM/Contribute/Form/ContributionRecur.php | 15 -------------- CRM/Core/Form/EntityFormTrait.php | 25 +++++++++++++++++++++++ CRM/Financial/Form/FinancialType.php | 7 ------- CRM/Member/Form.php | 18 ---------------- CRM/Member/Form/MembershipStatus.php | 16 --------------- CRM/Member/Form/MembershipType.php | 18 ---------------- CRM/Price/Form/Set.php | 15 -------------- CRM/UF/Form/Group.php | 18 ---------------- 10 files changed, 25 insertions(+), 145 deletions(-) diff --git a/CRM/Admin/Form/PaymentProcessor.php b/CRM/Admin/Form/PaymentProcessor.php index 1e04b95497..f35eda6afa 100644 --- a/CRM/Admin/Form/PaymentProcessor.php +++ b/CRM/Admin/Form/PaymentProcessor.php @@ -39,25 +39,6 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form { */ protected $_paymentProcessorType; - /** - * Fields for the entity to be assigned to the template. - * - * Fields may have keys - * - name (required to show in tpl from the array) - * - description (optional, will appear below the field) - * Auto-added by setEntityFieldsMetadata unless specified here (use description => '' to hide) - * - not-auto-addable - this class will not attempt to add the field using addField. - * (this will be automatically set if the field does not have html in it's metadata - * or is not a core field on the form's entity). - * - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']] - * - template - use a field specific template to render this field - * - required - * - is_freeze (field should be frozen). - * - * @var array - */ - protected $entityFields = []; - /** * Set entity fields to be assigned to the form. */ diff --git a/CRM/Admin/Form/RelationshipType.php b/CRM/Admin/Form/RelationshipType.php index b6c02254fe..a44d987eb3 100644 --- a/CRM/Admin/Form/RelationshipType.php +++ b/CRM/Admin/Form/RelationshipType.php @@ -24,25 +24,6 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form { protected $_BAOName = 'CRM_Contact_BAO_RelationshipType'; - /** - * Fields for the entity to be assigned to the template. - * - * Fields may have keys - * - name (required to show in tpl from the array) - * - description (optional, will appear below the field) - * Auto-added by setEntityFieldsMetadata unless specified here (use description => '' to hide) - * - not-auto-addable - this class will not attempt to add the field using addField. - * (this will be automatically set if the field does not have html in it's metadata - * or is not a core field on the form's entity). - * - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']] - * - template - use a field specific template to render this field - * - required - * - is_freeze (field should be frozen). - * - * @var array - */ - protected $entityFields = []; - /** * Set entity fields to be assigned to the form. */ diff --git a/CRM/Contribute/Form/ContributionRecur.php b/CRM/Contribute/Form/ContributionRecur.php index ccf86182b1..7402e94cad 100644 --- a/CRM/Contribute/Form/ContributionRecur.php +++ b/CRM/Contribute/Form/ContributionRecur.php @@ -69,21 +69,6 @@ class CRM_Contribute_Form_ContributionRecur extends CRM_Core_Form { */ public $_paymentProcessor = []; - /** - * Fields for the entity to be assigned to the template. - * - * Fields may have keys - * - name (required to show in tpl from the array) - * - description (optional, will appear below the field) - * - not-auto-addable - this class will not attempt to add the field using addField. - * (this will be automatically set if the field does not have html in it's metadata - * or is not a core field on the form's entity). - * - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']] - * - template - use a field specific template to render this field - * @var array - */ - protected $entityFields = []; - /** * Details of the subscription (recurring contribution) to be altered. * diff --git a/CRM/Core/Form/EntityFormTrait.php b/CRM/Core/Form/EntityFormTrait.php index 1a4c1beefe..2d09fa550a 100644 --- a/CRM/Core/Form/EntityFormTrait.php +++ b/CRM/Core/Form/EntityFormTrait.php @@ -40,6 +40,31 @@ trait CRM_Core_Form_EntityFormTrait { */ protected $deleteMessage; + /** + * Fields for the entity to be assigned to the template. + * + * Fields may have keys + * - name (required to show in tpl from the array) + * - description (optional, will appear below the field) + * - not-auto-addable - this class will not attempt to add the field using addField. + * (this will be automatically set if the field does not have html in it's metadata + * or is not a core field on the form's entity). + * - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']] + * - template - use a field specific template to render this field + * - required + * - is_freeze (field should be frozen). + * + * @var array + */ + protected $entityFields = []; + + /** + * Metadata from getfields API call for the current entity. + * + * @var array + */ + protected $metadata = []; + /** * Get entity fields for the entity to be added to the form. * diff --git a/CRM/Financial/Form/FinancialType.php b/CRM/Financial/Form/FinancialType.php index 3d9f046966..4702155253 100644 --- a/CRM/Financial/Form/FinancialType.php +++ b/CRM/Financial/Form/FinancialType.php @@ -24,13 +24,6 @@ class CRM_Financial_Form_FinancialType extends CRM_Core_Form { protected $_BAOName = 'CRM_Financial_BAO_FinancialType'; - /** - * Fields for the entity to be assigned to the template. - * - * @var array - */ - protected $entityFields = []; - /** * Set variables up before form is built. * diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php index e52bccbea9..b50799354c 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -121,24 +121,6 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { */ protected $_params = []; - /** - * Fields for the entity to be assigned to the template. - * - * Fields may have keys - * - name (required to show in tpl from the array) - * - description (optional, will appear below the field) - * - not-auto-addable - this class will not attempt to add the field using addField. - * (this will be automatically set if the field does not have html in it's metadata - * or is not a core field on the form's entity). - * - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']] - * - template - use a field specific template to render this field - * - required - * - is_freeze (field should be frozen). - * - * @var array - */ - protected $entityFields = []; - public function preProcess() { // Check for edit permission. if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) { diff --git a/CRM/Member/Form/MembershipStatus.php b/CRM/Member/Form/MembershipStatus.php index 967e81bfd2..af276795fc 100644 --- a/CRM/Member/Form/MembershipStatus.php +++ b/CRM/Member/Form/MembershipStatus.php @@ -36,22 +36,6 @@ class CRM_Member_Form_MembershipStatus extends CRM_Core_Form { return 'create'; } - /** - * Fields for the entity to be assigned to the template. - * - * Fields may have keys - * - name (required to show in tpl from the array) - * - description (optional, will appear below the field) - * - not-auto-addable - this class will not attempt to add the field using addField. - * (this will be automatically set if the field does not have html in it's metadata - * or is not a core field on the form's entity). - * - help (optional) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']] - * - template - use a field specific template to render this field - * - required - * @var array - */ - protected $entityFields = []; - /** * Set entity fields to be assigned to the form. */ diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index 17586c6478..e8992363fc 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -23,24 +23,6 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form_MembershipConfig { use CRM_Core_Form_EntityFormTrait; - /** - * Fields for the entity to be assigned to the template. - * - * Fields may have keys - * - name (required to show in tpl from the array) - * - description (optional, will appear below the field) - * - not-auto-addable - this class will not attempt to add the field using addField. - * (this will be automatically set if the field does not have html in it's metadata - * or is not a core field on the form's entity). - * - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']] - * - template - use a field specific template to render this field - * - required - * - is_freeze (field should be frozen). - * - * @var array - */ - protected $entityFields = []; - /** * Set entity fields to be assigned to the form. */ diff --git a/CRM/Price/Form/Set.php b/CRM/Price/Form/Set.php index a9c8af8017..9bf062edb5 100644 --- a/CRM/Price/Form/Set.php +++ b/CRM/Price/Form/Set.php @@ -45,21 +45,6 @@ class CRM_Price_Form_Set extends CRM_Core_Form { return 'PriceSet'; } - /** - * Fields for the entity to be assigned to the template. - * - * Fields may have keys - * - name (required to show in tpl from the array) - * - description (optional, will appear below the field) - * - not-auto-addable - this class will not attempt to add the field using addField. - * (this will be automatically set if the field does not have html in it's metadata - * or is not a core field on the form's entity). - * - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']] - * - template - use a field specific template to render this field - * @var array - */ - protected $entityFields = []; - /** * Set entity fields to be assigned to the form. */ diff --git a/CRM/UF/Form/Group.php b/CRM/UF/Form/Group.php index c3cdcc4b78..881b1ceedf 100644 --- a/CRM/UF/Form/Group.php +++ b/CRM/UF/Form/Group.php @@ -22,24 +22,6 @@ class CRM_UF_Form_Group extends CRM_Core_Form { use CRM_Core_Form_EntityFormTrait; - /** - * Fields for the entity to be assigned to the template. - * - * Fields may have keys - * - name (required to show in tpl from the array) - * - description (optional, will appear below the field) - * - not-auto-addable - this class will not attempt to add the field using addField. - * (this will be automatically set if the field does not have html in it's metadata - * or is not a core field on the form's entity). - * - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']] - * - template - use a field specific template to render this field - * - required - * - is_freeze (field should be frozen). - * - * @var array - */ - protected $entityFields = []; - /** * @var bool */ -- 2.25.1