function salesforce_api_requirements in Salesforce Suite 7
Same name and namespace in other branches
- 6.2 salesforce_api/salesforce_api.install \salesforce_api_requirements()
- 7.2 salesforce_api/salesforce_api.install \salesforce_api_requirements()
Implements hook_requirements().
Check the Salesforce API configuration to see if we have valid credentials.
File
- salesforce_api/
salesforce_api.install, line 143 - Installs any global tables needed for Salesforce integration.
Code
function salesforce_api_requirements($phase) {
$req = array();
switch ($phase) {
case 'install':
break;
case 'runtime':
$username = variable_get('salesforce_api_username', FALSE);
if (!$username) {
$description = l(t('Enter your Salesforce credentials.'), SALESFORCE_PATH_ADMIN);
$severity = REQUIREMENT_ERROR;
}
elseif (!salesforce_api_connect()) {
$description = t('Unable to connect to Salesforce using <a href="!url">current credentials</a>.', array(
'!url' => url(SALESFORCE_PATH_ADMIN),
));
$severity = REQUIREMENT_ERROR;
}
else {
$description = '';
$severity = REQUIREMENT_OK;
}
$req[] = array(
'title' => t('Salesforce Configuration'),
'value' => l('Salesforce Admin', SALESFORCE_PATH_ADMIN),
'description' => $description,
'severity' => $severity,
);
break;
}
if (!empty($req)) {
return $req;
}
}