You are here

function flickr_admin_settings in Flickr 5

Same name and namespace in other branches
  1. 6 flickr.admin.inc \flickr_admin_settings()
  2. 7 flickr.admin.inc \flickr_admin_settings()

Implementation of hook_settings

1 string reference to 'flickr_admin_settings'
flickr_menu in ./flickr.module
Implementation of hook_menu().

File

./flickr.module, line 100

Code

function flickr_admin_settings() {
  $form['#validate'] = array(
    'flickr_admin_settings_validate' => array(),
  );
  $form['flickr_api_key'] = array(
    '#type' => 'textfield',
    '#title' => t('API Key'),
    '#required' => TRUE,
    '#default_value' => variable_get('flickr_api_key', ''),
    '#description' => t('API Key from Flickr'),
  );
  $form['flickr_api_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('API Shared Secret'),
    '#required' => TRUE,
    '#default_value' => variable_get('flickr_api_secret', ''),
    '#description' => t("API key's secret from Flickr."),
  );
  $form['flickr_default_userid'] = array(
    '#type' => 'textfield',
    '#title' => t('Default Flickr User Id'),
    '#default_value' => variable_get('flickr_default_userid', ''),
    '#description' => t("An, optional, default Flickr username or user id. This will be used when no user is specified."),
  );
  $times = array(
    900,
    1800,
    2700,
    3600,
    7200,
    10800,
    14400,
    18000,
    21600,
    43200,
    86400,
  );
  $ageoptions = drupal_map_assoc($times, 'format_interval');
  $form['flickr_cache_duration'] = array(
    '#type' => 'select',
    '#title' => t('Update interval'),
    '#options' => $ageoptions,
    '#default_value' => variable_get('flickr_cache_duration', 3600),
    '#description' => t("The refresh interval indicating how often you want to check cached Flickr API calls are up to date."),
  );

  // we need an api key before we can verify usernames
  if (!$form['flickr_api_key']['#default_value']) {
    $form['flickr_default_userid']['#disabled'] = TRUE;
    $form['flickr_default_userid']['#description'] .= t(" Disabled until a valid API Key is set.");
  }
  return system_settings_form($form);
}