You are here

function _follow_links_form_link in Follow 6

Same name and namespace in other branches
  1. 5 follow.module \_follow_links_form_link()
  2. 7.2 follow.module \_follow_links_form_link()
  3. 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 481
Allows users to add links to their social network profiles.

Code

function _follow_links_form_link($link, $title, $uid) {
  $elements = array();
  $elements['name'] = array(
    '#type' => 'markup',
    '#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',
    ),
    '#maxlength' => 255,
  );

  // 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;
}