Skip to content

Instantly share code, notes, and snippets.

@xurizaemon
Created October 14, 2013 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xurizaemon/6984345 to your computer and use it in GitHub Desktop.
Save xurizaemon/6984345 to your computer and use it in GitHub Desktop.
CiviCRM - implementation of hook_civicrm_buildForm() to remove required billing address fields.
/**
* Implements hook_civicrm_buildForm().
*/
function example_civicrm_buildForm($formName, &$form) {
switch ($formName) {
case 'CRM_Contribute_Form_Contribution_Main':
$fields_not_required = array(
'billing_first_name',
'billing_middle_name',
'billing_last_name',
'billing_street_address-5',
'billing_city-5',
'billing_state_province_id-5',
'billing_postal_code-5',
'billing_country_id-5',
);
foreach ($fields_not_required as $field) {
$form->_paymentFields[$field]['is_required'] = FALSE;
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment