function salesforce_form_alter in Salesforce Suite 5
Implementation of hook_form_alter().
File
- ./
salesforce.module, line 219 - Original Creator, Maintainer & Developer: Steve McKenzie (http://drupal.org/user/45890) Drupal and Salesforce.com (mainly only working with contacts / leads but can be extended to do anything the salesforce API version 6 can do) Current…
Code
function salesforce_form_alter($form_id, &$form) {
if (_salesforce_is_form('leads', $form_id)) {
// TODO: not needed yet but do we need this?
//$form['#submit']['salesforce_form_lead_submit'] = array();
}
if (_salesforce_is_form('events', $form_id)) {
$form['#submit']['salesforce_form_event_submit'] = array();
}
if (module_exists('contact') && $form_id == 'contact_mail_page') {
$form['#submit']['salesforce_contact_form'] = array();
}
if ($form_id == 'user_register' || $form_id == 'user_edit') {
$leads = _salesforce_is_form('leads', $form_id);
if (user_access('administer salesforce')) {
$uid = arg(1);
if (is_numeric($uid)) {
$account = user_load(array(
'uid' => $uid,
));
if ($account->salesforce['lead_id']) {
return;
}
}
if ($leads) {
$form['create_lead'] = array(
'#type' => 'checkbox',
'#title' => t('create a lead in salesforce'),
'#default_value' => true,
);
}
}
else {
if ($leads) {
$form['create_lead'] = array(
'#type' => 'hidden',
'#value' => true,
);
}
}
}
}