function follow_links_form in Follow 7
Same name and namespace in other branches
- 5 follow.module \follow_links_form()
- 6 follow.module \follow_links_form()
- 7.2 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 406 - Allows users to add links to their social network profiles.
Code
function follow_links_form($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'),
'wpzoom26' => t('WPZOOM 26x'),
'wpzoom38' => t('WPZOOM 38x'),
'paulrobertlloyd32' => t('Paul Robert Lloyd 32x32'),
),
'#description' => t('How the Follow icons should appear.'),
'#default_value' => variable_get('follow_icon_style', 'small'),
'#access' => $uid < 1,
);
// Allow changing which icon style to use on the global service links.
$form['follow_alignment'] = array(
'#type' => 'select',
'#title' => t('Alignment'),
'#options' => array(
'vertical' => t('Vertical'),
'horizontal' => t('Horizontal'),
),
'#description' => t('Whether the icons are to appear horizontally beside each other, or one after another in a list.'),
'#default_value' => variable_get('follow_alignment', 'vertical'),
'#access' => $uid < 1,
);
// List all the available links.
$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;
}