You are here

function mostpopular_addthis_config_form in Drupal Most Popular 7

Implements the 'config_form' callback for the AddThis.com service.

Parameters

object $service The service definition.:

array $form_state The current state of the form.:

File

modules/mostpopular_addthis/mostpopular_addthis.module, line 112
Uses the AddThis.com Analytics API to provide Most Popular data.

Code

function mostpopular_addthis_config_form($service, &$form_state) {
  $form = array();
  $form['auth'] = array(
    '#type' => 'fieldset',
    '#title' => t('AddThis.com login credentials'),
  );
  $form['auth']['username'] = array(
    '#type' => 'textfield',
    '#title' => t('User Name'),
    '#required' => TRUE,
    '#default_value' => !empty($service->data['auth']['username']) ? $service->data['auth']['username'] : '',
  );
  $form['auth']['password'] = array(
    '#type' => 'textfield',
    '#title' => t('Password'),
    '#required' => TRUE,
    '#default_value' => !empty($service->data['auth']['password']) ? $service->data['auth']['password'] : '',
  );
  $form['auth']['pubid'] = array(
    '#type' => 'textfield',
    '#title' => t('Publisher Profile ID'),
    '#default_value' => !empty($service->data['auth']['pubid']) ? $service->data['auth']['pubid'] : '',
  );
  $form['auth']['domain'] = array(
    '#type' => 'textfield',
    '#title' => t('Domain'),
    '#default_value' => !empty($service->data['auth']['domain']) ? $service->data['auth']['domain'] : '',
    '#description' => t('Limit response data only on the specified domain.'),
  );
  $form['services'] = array(
    '#type' => 'select',
    '#title' => t('Sharing services'),
    '#description' => t('Choose one or more sharing services you would like included in these metrics.'),
    '#multiple' => TRUE,
    '#required' => TRUE,
    '#default_value' => !empty($service->data['services']) ? $service->data['services'] : 'email,mailto',
    '#options' => mostpopular_addthis_service_options(),
  );
  return $form;
}