function _follow_links_form_link in Follow 5
Same name and namespace in other branches
- 6 follow.module \_follow_links_form_link()
- 7.2 follow.module \_follow_links_form_link()
- 7 follow.module \_follow_links_form_link()
Helper function to create an individual link form element.
1 call to _follow_links_form_link()
- follow_links_form in ./
follow.module - The form for editing follow links.
File
- ./
follow.module, line 372 - Allows users to add links to their social network profiles.
Code
function _follow_links_form_link($link, $title, $uid) {
$elements = array(
'#tree' => TRUE,
);
$elements['name'] = array(
'#value' => $title,
);
if (isset($link->lid)) {
$elements['lid'] = array(
'#type' => 'hidden',
'#value' => $link->lid,
);
$elements['weight'] = array(
'#type' => 'weight',
'#default_value' => $link->weight,
);
}
$elements['url'] = array(
'#type' => 'textfield',
'#follow_network' => $link->name,
'#follow_uid' => $uid,
'#default_value' => isset($link->url) ? $link->url : '',
'#element_validate' => array(
'follow_url_validate',
),
);
// Provide the title of the link only if the link URL is there and the user
// has the appropriate access.
$elements['title'] = array(
'#type' => 'textfield',
'#default_value' => isset($link->title) ? $link->title : '',
'#size' => 15,
'#access' => user_access('change follow link titles') && !empty($link->url),
);
return $elements;
}