You are here

function flickrfield_process in Flickr 6

1 string reference to 'flickrfield_process'
flickrfield_elements in field/flickrfield.module

File

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

Code

function flickrfield_process($element, $edit, $form_state, $form) {

  // Build the flickr URL from the flickr values in the database.
  if (!empty($element['#value']['nsid']) && !empty($element['#value']['id'])) {

    // We have a photo id.
    if ($element['#value']['type'] == 'photo_id') {
      $default_url = flickr_photo_page_url($element['#value']['nsid'], $element['#value']['id']);
    }
    else {

      // .We have a set id.
      $default_url = flickr_photoset_page_url($element['#value']['nsid'], $element['#value']['id']);
    }
  }
  else {

    // We have no id (than an empty flickrfield).
    $default_url = '';
  }
  $element['url'] = array(
    '#type' => 'textfield',
    '#title' => 'Image or Photoset URL',
    '#default_value' => $default_url,
    '#description' => t('Enter the URL to the Flickr image or image set.'),
  );
  return $element;
}