You are here

function linkedin_status_form_alter in LinkedIn Integration 7

Same name and namespace in other branches
  1. 6 linkedin_status/linkedin_status.module \linkedin_status_form_alter()

File

linkedin_status/linkedin_status.module, line 60
Main hooks implementation for LinkedIn Profile module

Code

function linkedin_status_form_alter(&$form, &$form_state, $form_id) {

  //add posting form into nodes edit page and comments
  if (isset($form['#node']) && user_access('update LinkedIn status')) {
    if ($form['#node']->type . '_node_form' == $form_id && variable_get('linkedin_status_enabled_' . $form['#node']->type, 0) == 1) {
      $node = $form['#node'];
    }
    elseif ('comment_node_' . $form['#node']->type . '_form' == $form_id && variable_get('linkedin_status_enabled_comment', 0) == 1) {
      $node = node_load($form['nid']['#value']);
    }
    else {
      return;
    }
    module_load_include('pages.inc', 'linkedin_status');
    global $user;
    $array = array();
    $form['linkedin'] = linkedin_status_update_form_elements($node, $user);
    array_unshift($form['#submit'], 'linkedin_status_update_form_submit');
  }
}