function follow_links_form_submit in Follow 7
Same name and namespace in other branches
- 5 follow.module \follow_links_form_submit()
- 6 follow.module \follow_links_form_submit()
- 7.2 follow.module \follow_links_form_submit()
Submit handler for the follow_links_form.
File
- ./
follow.module, line 604 - Allows users to add links to their social network profiles.
Code
function follow_links_form_submit($form, &$form_state) {
$values = $form_state['values'];
$links = $values['follow_links'];
foreach ($links as $name => $link) {
$link = (object) $link;
$link->url = trim($link->url);
// Check to see if there's actually a link
if (empty($link->url)) {
// If there's an lid, delete the link.
if (isset($link->lid)) {
follow_link_delete($link->lid);
}
// Continue to the next link.
continue;
}
else {
$link->uid = $values['uid'];
$link->name = $name;
follow_link_save($link);
}
}
// Save the Follow icon style.
$icon_style = $values['follow_icon_style'];
if (in_array($icon_style, array(
'small',
'large',
'wpzoom26',
'wpzoom38',
'paulrobertlloyd32',
))) {
variable_set('follow_icon_style', $icon_style);
}
// Save the Follow alignment.
$alignment = $values['follow_alignment'];
if (in_array($alignment, array(
'vertical',
'horizontal',
))) {
variable_set('follow_alignment', $alignment);
}
}