You are here

function filefield_source_remote_process in FileField Sources 6

Same name and namespace in other branches
  1. 7 sources/remote.inc \filefield_source_remote_process()

A #process callback to extend the filefield_widget element type.

1 string reference to 'filefield_source_remote_process'
filefield_source_remote_info in sources/remote.inc
Implements hook_filefield_source_info().

File

sources/remote.inc, line 72
A FileField extension to allow referencing of existing files.

Code

function filefield_source_remote_process($element, $edit, &$form_state, $form) {
  $element['filefield_remote'] = array(
    '#weight' => 100.5,
    '#theme' => 'filefield_source_remote_element',
    '#filefield_source' => TRUE,
    // Required for proper theming.
    '#filefield_sources_hint_text' => FILEFIELD_SOURCE_REMOTE_HINT_TEXT,
  );
  $element['filefield_remote']['url'] = array(
    '#type' => 'textfield',
    '#description' => filefield_sources_element_validation_help($element['#upload_validators']),
    '#maxlength' => NULL,
  );
  $element['filefield_remote']['transfer'] = array(
    '#name' => implode('_', $element['#array_parents']) . '_transfer',
    '#type' => 'submit',
    '#value' => t('Transfer'),
    '#validate' => array(),
    '#submit' => array(
      'node_form_submit_build_node',
    ),
    '#ahah' => array(
      'path' => 'filefield/ahah/' . $element['#type_name'] . '/' . $element['#field_name'] . '/' . $element['#delta'],
      'wrapper' => $element['#id'] . '-ahah-wrapper',
      'method' => 'replace',
      'effect' => 'fade',
      'progress' => array(
        'type' => 'bar',
        'path' => 'filefield/remote/progress/' . $element['#type_name'] . '/' . $element['#field_name'] . '/' . $element['#delta'],
        'message' => t('Starting transfer...'),
      ),
    ),
  );
  return $element;
}