You are here

function drupagram_admin_form in Drupagram 7

Same name and namespace in other branches
  1. 6 drupagram.pages.inc \drupagram_admin_form()

Form builder; Instagram settings form.

1 string reference to 'drupagram_admin_form'
drupagram_menu in ./drupagram.module
Implements hook_menu().

File

./drupagram.pages.inc, line 11
Drupagram admin page callaback functions.

Code

function drupagram_admin_form($form, &$form_state) {
  $form['drupagram_import'] = array(
    '#type' => 'checkbox',
    '#title' => t('Import and display the Instagram statuses of site users who have entered their Instagram account information.'),
    '#default_value' => variable_get('drupagram_import', 1),
  );
  $form['drupagram_expire'] = array(
    '#type' => 'select',
    '#title' => t('Delete old items'),
    '#default_value' => variable_get('drupagram_expire', 0),
    '#options' => array(
      0 => t('Never'),
    ) + drupal_map_assoc(array(
      604800,
      2592000,
      7776000,
      31536000,
    ), 'format_interval'),
    '#states' => array(
      'visible' => array(
        ':input[name=drupagram_import]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['oauth'] = array(
    '#type' => 'fieldset',
    '#title' => t('Instagram OAuth Settings'),
    '#access' => module_exists('oauth_common'),
    '#description' => t('To enable OAuth based access for drupagram, you must <a href="@url" target="_blank">register your application</a> with Instagram and add the provided keys here.', array(
      '@url' => DRUPAGRAM_URL_APP_REGISTER,
    )),
  );
  $form['oauth']['drupagram_client_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Instagram Client ID'),
    '#default_value' => variable_get('drupagram_client_id', NULL),
  );
  $form['oauth']['drupagram_client_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Instagram Client Secret'),
    '#default_value' => variable_get('drupagram_client_secret', NULL),
  );
  $form['oauth']['callback_url'] = array(
    '#type' => 'item',
    '#title' => t('Callback URL'),
    '#markup' => url('instagram/oauth', array(
      'absolute' => TRUE,
    )),
  );
  return system_settings_form($form);
}