You are here

function follow_links_form_submit in Follow 7.2

Same name and namespace in other branches
  1. 5 follow.module \follow_links_form_submit()
  2. 6 follow.module \follow_links_form_submit()
  3. 7 follow.module \follow_links_form_submit()

Submit handler for the follow_links_form.

File

./follow.module, line 529

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