function key_get_integrations in Key 7
Gets information about key integrations.
Parameters
string $status: An enabled status by which to filter the results.
string $type: An integration type by which to filter the results.
bool $reset: A flag to force a reset of the integration data.
Return value
array An array of integrations.
3 calls to key_get_integrations()
- key_get_integration in ./
key.module - Gets information about a specific key integration.
- key_get_integrations_as_options in ./
key.module - Gets all key integrations as options, for use in forms.
- key_ui_key_integration_form in modules/
key_ui/ includes/ key_ui.admin.inc - Menu callback; displays the list of key integrations.
File
- ./
key.module, line 501 - Provides the ability to manage keys, which can be used by other modules.
Code
function key_get_integrations($status = NULL, $type = NULL, $reset = FALSE) {
$integrations =& drupal_static(__FUNCTION__);
if ($reset) {
_key_clear_plugin_cache('key_integration');
}
if (!isset($integrations) || $reset) {
ctools_include('plugins');
$integrations = ctools_get_plugins('key', 'key_integration');
}
// If no filtering should occur, return all integrations.
if (!$status && !$type) {
return $integrations;
}
$filtered_integrations = $integrations;
// Filter integrations by status and/or type.
foreach ($integrations as $name => $integration) {
if ($status == 'enabled' && !$integration['enabled']) {
unset($filtered_integrations[$name]);
continue;
}
if ($status == 'disabled' && $integration['enabled']) {
unset($filtered_integrations[$name]);
continue;
}
if (isset($type) && $integration['type'] != $type) {
unset($filtered_integrations[$name]);
continue;
}
}
return $filtered_integrations;
}