You are here

function emvideo_flickr_sets_settings in Media: Flickr 6

hook emvideo_PROVIDER_settings this should return a subform to be added to the emvideo_settings() admin settings page. note that a form field will already be provided, at $form['PROVIDER'] (such as $form['flickr_sets']) so if you want specific provider settings within that field, you can add the elements to that form field.

File

providers/emvideo/flickr_sets.inc, line 49
This include processes flickr.com photosets for use by emfield/emvideo.module.

Code

function emvideo_flickr_sets_settings() {
  if (!function_exists('emfield_imagerotator_url')) {
    drupal_set_message(t('You should upgrade to a newer version of !emfield if you wish support for the !player or !imagerotator.', array(
      '!emfield' => l(t('Embedded Media Field'), 'https://drupal.org/project/emfield'),
      '!player' => l(t('JW Flash Media Player'), 'http://www.longtailvideo.com/players/jw-flv-player/'),
      '!imagerotator' => l(t('JW Image Rotator'), 'http://www.longtailvideo.com/players/jw-image-rotator/'),
    )), 'error');
  }
  $form['flickr_sets']['media_flickr_store_local'] = array(
    '#type' => 'checkbox',
    '#title' => t('Store images locally'),
    '#description' => t('If checked, then images from Flickr will be stored locally.'),
    '#default_value' => variable_get('media_flickr_store_local', FALSE),
  );
  $form['flickr_sets']['media_flickr_max_saves'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum local saves per page load'),
    '#description' => t('This will limit the number of remote files that will be stored locally from Flickr per page load when storing a photoset locally, causing the rest in that specific view to be displayed from the remote location. If you set this to 0, then all such files will be stored on the initial slideshow view. Note that setting this to 0 or to an arbitrarily large number can cause the initial view to take a very long time, or even cause the browser to time out. Also note that this setting has no effect if the images are not to be stored locally.'),
    '#default_value' => variable_get('media_flickr_max_saves', 10),
  );
  if (function_exists('emimage_flickr_settings')) {
    $form['flickr_sets']['api'] = array(
      '#type' => 'fieldset',
      '#title' => t('Flickr API'),
      '#description' => t('You will first need to apply for an API Developer Key from the <a href="@flickr" target="_blank">Flickr Developer Profile page</a>.', array(
        '@flickr' => MEDIA_FLICKR_API_APPLICATION_URL,
      )),
      '#collapsible' => TRUE,
      '#collapsed' => variable_get('emimage_flickr_api_key', '') != '',
    );
    $form['flickr_sets']['api']['notice'] = array(
      '#type' => 'item',
      '#value' => t('Please enter your Flickr Developer Key in the fieldset for Flickr, in the Embedded Image Field field set above.'),
    );
  }
  else {
    $form['flickr_sets']['api'] = array(
      '#type' => 'fieldset',
      '#title' => t('Flickr API'),
      '#description' => t('You will first need to apply for an API Developer Key from the <a href="@flickr" target="_blank">Flickr Developer Profile page</a>.', array(
        '@flickr' => MEDIA_FLICKR_API_APPLICATION_URL,
      )),
      '#collapsible' => TRUE,
      '#collapsed' => variable_get('emimage_flickr_api_key', '') != '',
    );
    $form['flickr_sets']['api']['emimage_flickr_api_key'] = array(
      '#type' => 'textfield',
      '#title' => t('Flickr API Key'),
      '#default_value' => variable_get('emimage_flickr_api_key', ''),
      '#description' => t('Please enter your Flickr Developer Key here.'),
    );
    $form['flickr_sets']['api']['emimage_flickr_api_secret'] = array(
      '#type' => 'textfield',
      '#title' => t('Flickr API Secret'),
      '#default_value' => variable_get('emimage_flickr_api_secret', ''),
      '#description' => t('If you have a secret for the Flickr API, enter it here.'),
    );
  }
  return $form;
}