function filefield_source_remote_process in FileField Sources 7
Same name and namespace in other branches
- 6 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 78 - A FileField extension to allow referencing of existing files.
Code
function filefield_source_remote_process($element, &$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(
'filefield_sources_field_submit',
),
'#limit_validation_errors' => array(
$element['#parents'],
),
'#ajax' => array(
'path' => 'file/ajax/' . implode('/', $element['#array_parents']) . '/' . $form['form_build_id']['#value'],
'wrapper' => $element['upload_button']['#ajax']['wrapper'],
'effect' => 'fade',
'progress' => array(
'type' => 'bar',
'path' => 'file/remote/progress/' . $element['#entity_type'] . '/' . $element['#bundle'] . '/' . $element['#field_name'] . '/' . $element['#delta'],
'message' => t('Starting transfer...'),
),
),
);
return $element;
}