You are here

function linkedin_status_linkedin_admin_page in LinkedIn Integration 7

Same name and namespace in other branches
  1. 6 linkedin_status/linkedin_status.pages.inc \linkedin_status_linkedin_admin_page()

@todo Please document this function.

See also

http://drupal.org/node/1354

File

linkedin_status/linkedin_status.pages.inc, line 12

Code

function linkedin_status_linkedin_admin_page() {
  $form = array();
  $form['linkedin_status'] = array(
    '#description' => t('Enable users to update their LinkedIn user status when performing following actions.'),
    '#title' => t('Status update'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['linkedin_status']['node_types'] = array(
    '#description' => t('Let users update their status when creating/editing nodes of these types.'),
    '#title' => t('Node types'),
    '#type' => 'fieldset',
  );
  $types = node_type_get_types();
  foreach ($types as $type) {
    $form['linkedin_status']['node_types']['linkedin_status_enabled_' . $type->type] = array(
      '#type' => 'checkbox',
      '#prefix' => '<div class="linkedin-checkbox-toggle">',
      '#suffix' => '</div>',
      '#title' => $type->name,
      '#default_value' => variable_get('linkedin_status_enabled_' . $type->type, '0'),
    );
    $form['linkedin_status']['node_types']['linkedin_status_default_format_' . $type->type] = array(
      '#type' => 'textfield',
      '#prefix' => '<div class="linkedin-hidden">',
      '#suffix' => '</div>',
      '#title' => t('Default format string'),
      '#maxlength' => 140,
      '#description' => t('Text that will be posted to Linked In. You can use !url, !title, !user, and !site as replacement text.'),
      '#default_value' => variable_get('linkedin_status_default_format_' . $type->type, 'Posted "!title" on !site'),
    );
  }
  if (module_exists('signup')) {
    $form['linkedin_status']['event_signup'] = array(
      '#description' => t('Let users update their status when signing up to events.'),
      '#title' => t('Users signup'),
      '#type' => 'fieldset',
    );
    $form['linkedin_status']['event_signup']['linkedin_status_enabled_event_signup'] = array(
      '#type' => 'checkbox',
      '#title' => 'Enable',
      '#default_value' => variable_get('linkedin_status_enabled_event_signup', '0'),
    );
    $form['linkedin_status']['event_signup']['linkedin_status_default_format_event_signup'] = array(
      '#type' => 'textfield',
      '#title' => t('Default format string'),
      '#maxlength' => 140,
      '#description' => t('Text that will be posted to Linked In. You can use !url, !title, !user, and !site as replacement text.'),
      '#default_value' => variable_get('linkedin_status_default_format_event_signup', 'Posted "!title" on !site'),
    );
  }

  //Enable status update on comments
  if (module_exists('comment')) {
    $form['linkedin_status']['comment'] = array(
      '#description' => t('Let users update their status when adding comments to a Linkedin enabled node.'),
      '#title' => t('Comments'),
      '#type' => 'fieldset',
    );
    $form['linkedin_status']['comment']['linkedin_status_enabled_comment'] = array(
      '#type' => 'checkbox',
      '#title' => 'Enable',
      '#default_value' => variable_get('linkedin_status_enabled_comment', '0'),
    );
    $form['linkedin_status']['comment']['linkedin_status_default_format_comment'] = array(
      '#type' => 'textfield',
      '#title' => t('Default format string'),
      '#maxlength' => 140,
      '#description' => t('Text that will be posted to Linked In. You can use !url, !title, !user, and !site as replacement text.'),
      '#default_value' => variable_get('linkedin_status_default_format_comment', 'Commented on  "!title" on !site'),
    );
  }
  return $form;
}