Skip to content

Commit

Permalink
Use getter function for entity id as on some forms is protected.
Browse files Browse the repository at this point in the history
Follow up to civicrm#12095
  • Loading branch information
eileenmcnaughton committed May 15, 2018
1 parent 5e5a67c commit 6134541
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CRM/Custom/Form/CustomData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
9 changes: 9 additions & 0 deletions CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 6134541

Please sign in to comment.