function connector_connections_list in Connector 7
Same name and namespace in other branches
- 6 connector.pages.inc \connector_connections_list()
@todo Please document this function.
See also
1 string reference to 'connector_connections_list'
- connector_user_settings in ./
connector.pages.inc - Menu callback for the user settings page
File
- ./
connector.pages.inc, line 32 - Contains all non-admin pages for the Connector module
Code
function connector_connections_list($form, $form_state, $connections, $primary, $account) {
$header = array(
'connector' => t('Connection'),
'cid' => t('External Id'),
'operations' => t('Operations'),
);
$options = array();
foreach ($connections as $connection) {
$connector = _connector_get_connectors($connection->connector);
$operations = array();
$operations[] = array(
'title' => t('Remove'),
'href' => 'user/' . $account->uid . '/connections/' . $connection->connector . '__' . $connection->cid . '/delete',
);
if (user_access('sync local profile with connections')) {
$operations[] = array(
'title' => t('Sync local profile with @name', array(
'@name' => $connector['title'],
)),
'href' => 'user/' . $account->uid . '/connections/' . $connection->connector . '__' . $connection->cid . '/sync',
);
}
$options[$connection->connector . '__' . $connection->cid] = array(
'connector' => $connector['title'],
'cid' => $connection->cid,
'operations' => theme('links', array(
'links' => $operations,
'attributes' => array(
'class' => array(
'links',
'inline',
),
),
)),
);
}
$primary = $primary->connector . '__' . $primary->cid;
$radios = array();
$form['header'] = array();
foreach ($header as $key => $value) {
$form['header'][$key] = array(
'#markup' => $value,
);
}
foreach ($options as $key => $option) {
$radios[$key] = '';
$form['connector'][$key] = array(
'#markup' => check_plain($option['connector']),
);
$form['cid'][$key] = array(
'#markup' => check_plain($option['cid']),
);
$form['operations'][$key] = array(
'#markup' => $option['operations'],
);
}
$form['primary'] = array(
'#type' => 'radios',
'#options' => $radios,
'#default_value' => $primary,
);
$form['#theme'] = 'connector_connections_list_tableselect';
$form['account'] = array(
'#type' => 'value',
'#value' => $account,
);
if (!empty($connections)) {
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Set primary connection'),
);
}
return $form;
}