function clients_connection_add in Web Service Clients 6.2
Same name and namespace in other branches
- 7 clients.connection.admin.inc \clients_connection_add()
- 7.2 clients.connection.admin.inc \clients_connection_add()
Menu callback for adding a new connection.
Parameters
$type: The name of a connection type.
1 string reference to 'clients_connection_add'
- clients_menu in ./
clients.module - Implementation of hook_menu().
File
- ./
clients.connection.admin.inc, line 65 - clients.connection.admin.inc Page callbacks relating to client connection admin.
Code
function clients_connection_add($type) {
// Check the type exists.
$connection_types = clients_get_connection_types();
if (!isset($connection_types[$type])) {
return drupal_not_found();
}
drupal_set_title(t('Add @name connection', array(
'@name' => $type,
)));
// Make a basic default connection object to pass to the form builder.
$data = new stdClass();
$data->type = $type;
$data->name = '';
$data->new = TRUE;
// This is a bit convoluted but it's simpler to just follow the same pattern
// that using CTools imposes on us rather than have two ways of doing it.
$class = 'clients_connection_' . $type;
$connection = new $class($data);
return drupal_get_form('clients_connection_form', $connection);
}