diff --git a/CRM/Custom/Form/CustomData.php b/CRM/Custom/Form/CustomData.php index 0473b33572a6..757808f1882b 100644 --- a/CRM/Custom/Form/CustomData.php +++ b/CRM/Custom/Form/CustomData.php @@ -54,17 +54,18 @@ class CRM_Custom_Form_CustomData { */ public static function addToForm(&$form, $subType = NULL, $subName = NULL, $groupCount = 1) { $entityName = $form->getDefaultEntity(); + $entityID = $form->getEntityId(); // when custom data is included in this page if (!empty($_POST['hidden_custom'])) { - self::preProcess($form, $subName, $subType, $groupCount, $entityName, $form->_id); + self::preProcess($form, $subName, $subType, $groupCount, $entityName, $entityID); self::buildQuickForm($form); self::setDefaultValues($form); } // need to assign custom data type and subtype to the template $form->assign('customDataType', $entityName); $form->assign('customDataSubType', $subType); - $form->assign('entityID', $form->_id); + $form->assign('entityID', $entityID); } /** diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 5a7ad1428ebf..32018d525d7d 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -111,6 +111,15 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { 'receive_date' => array('default' => 'now'), ); + /** + * Get the entity id being edited. + * + * @return int|null + */ + public function getEntityId() { + return $this->_id; + } + /** * Get selected membership type from the form values. *