function _autoupload_get_predefined in AutoUpload 7
Admin helper function to return the predefined file field types.
The $types array data is passed to the autoUpload JavaScript var selectors index : type of file handled value : Array containing selectors for file input and submit button context - context of the file select elements file_input - file input selector file_event - file input event submit_input - submit input selector submit_event - event type on submit input to trigger upload/selection error - error element selector error_remove - indicates how to handle error removal. empty - error removal is not needed, already handled 'id' - selector is an id. remove the id from the element 'class' - selector is a class. remove the class from the element 'element' - remove the entire error element
3 calls to _autoupload_get_predefined()
- autoupload_admin_form_submit in ./
autoupload.admin.inc - Submit handler for autoupload settings form.
- autoupload_form_alter in ./
autoupload.module - Implements hook_form_alter().
- _autoupload_get_predefined_names in ./
autoupload.module - Helper function that returns names of all the predefined field types.
File
- ./
autoupload.module, line 116 - Allows users to upload files without clicking the upload button
Code
function _autoupload_get_predefined($type = NULL) {
$types = array(
'managed_file' => array(
'context' => 'div.form-managed-file',
'file_input' => 'input.form-file',
'file_event' => 'change',
'submit_input' => 'input.form-submit[value=Upload]',
'submit_event' => 'mousedown',
'error' => 'div.error',
'error_remove' => '',
),
'media' => array(
'context' => '#media-add-upload',
'file_input' => '#edit-upload',
'file_event' => 'change',
'submit_input' => '#edit-submit',
'submit_event' => 'click',
'error' => 'input.error',
'error_remove' => 'class',
),
'media_library' => array(
'context' => '#media-tab-library',
'file_input' => 'li',
'file_event' => 'mouseup',
'submit_input' => 'a.button-yes',
'submit_event' => 'click',
'error' => '',
'error_remove' => '',
),
);
return $type ? isset($types[$type]) ? $types[$type] : NULL : $types;
}