You are here

function drupagram_admin_form in Drupagram 6

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

Form builder; Instagram settings form.

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

File

./drupagram.pages.inc, line 12
Provieds drupagram forms.

Code

function drupagram_admin_form(&$form_state) {
  $form = array();
  $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' => 'http://instagram.com/developer/clients/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'),
    '#value' => url('instagram/oauth', array(
      'absolute' => TRUE,
    )),
  );
  return system_settings_form($form);
}