function follow_links_form in Follow 6
Same name and namespace in other branches
- 5 follow.module \follow_links_form()
- 7.2 follow.module \follow_links_form()
- 7 follow.module \follow_links_form()
The form for editing follow links.
Parameters
$form_state: A keyed array containing the current state of the form.
$uid: The uid of the user account. Defaults to the site form, $uid = 0.
1 string reference to 'follow_links_form'
- follow_menu in ./
follow.module - Implementation of hook_menu().
File
- ./
follow.module, line 436 - Allows users to add links to their social network profiles.
Code
function follow_links_form(&$form_state, $uid = 0) {
$form = array();
$form['uid'] = array(
'#type' => 'hidden',
'#value' => $uid,
);
$form['follow_links']['#tree'] = TRUE;
// Allow changing which icon style to use on the global service links.
$form['follow_icon_style'] = array(
'#type' => 'select',
'#title' => t('Icon Style'),
'#options' => array(
'small' => t('Small'),
'large' => t('Large'),
),
'#default_value' => variable_get('follow_icon_style', 'small'),
'#access' => $uid < 1,
);
$links = follow_links_load($uid);
$networks = follow_networks_load($uid, TRUE);
// Put all our existing links at the top, sorted by weight.
if (is_array($links)) {
foreach ($links as $name => $link) {
$title = $networks[$name]['title'];
$form['follow_links'][$name] = _follow_links_form_link($link, $title, $uid);
// Unset this specific network so we don't add the same one again below.
unset($networks[$name]);
}
}
// Now add all the empty ones.
foreach ($networks as $name => $info) {
$link = new stdClass();
$link->name = $name;
$form['follow_links'][$name] = _follow_links_form_link($link, $info['title'], $uid);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}