You are here

function flickrfield_form_process_flickrfield in Flickr 7

Form process callback for flickr photo fields.

1 string reference to 'flickrfield_form_process_flickrfield'
flickrfield_element_info in field/flickrfield.module
Implements hook_element_info().

File

field/flickrfield.module, line 98
Defines a Flickr field type.

Code

function flickrfield_form_process_flickrfield($element, $form_state, $form = array()) {
  $options = array();
  $options['photo_id'] = t("Photo");
  $options['id'] = t("Photoset");
  $element['type'] = array(
    '#type' => 'select',
    '#title' => t('Item Type'),
    '#default_value' => !empty($element['#value']['type']) ? $element['#value']['type'] : '',
    '#options' => $options,
  );
  $element['id'] = array(
    '#type' => 'textfield',
    '#title' => t('Item id'),
    '#maxlength' => 64,
    '#default_value' => !empty($element['#value']['id']) ? $element['#value']['id'] : '',
  );
  $idgettr = l(t('Find your Flickr ID.'), 'http://idgettr.com/', array(
    'attributes' => array(
      'title' => t('Use the URL of your photostream to find the Flickr ID.'),
      'target' => '_blank',
    ),
  ));
  $element['nsid'] = array(
    '#type' => 'textfield',
    '#title' => t('User Id'),
    '#maxlength' => 64,
    '#default_value' => !empty($element['#value']['nsid']) ? $element['#value']['nsid'] : variable_get('flickr_default_userid', ''),
    '#required' => $element['#required'],
    '#description' => t("The user id of the Flickr user who owns the photos. If this is left blank, the sites's default user will be used. Current default id is @id. !find_id", array(
      '@id' => !empty(variable_get('flickr_default_userid', '')) ? variable_get('flickr_default_userid', '') : t('not set'),
      '!find_id' => $idgettr,
    )),
  );
  drupal_alter('flickrfield_process', $element);
  return $element;
}